### Run BYOB Server Source: https://github.com/malwaredllc/byob/blob/master/byob/README.md Starts the BYOB server with optional host, port, and database path parameters. If no parameters are provided, it defaults to listening on 0.0.0.0:1337 and using 'database.db' for storage. ```python python3 server.py --host --port --db ``` ```python python3 server.py ``` -------------------------------- ### Install BYOB CLI on Linux Source: https://github.com/malwaredllc/byob/blob/master/byob/README.md Installs BYOB CLI on Linux systems using apt package manager. It clones the repository, installs Python 3.6+, pip, OpenCV, CMake, build essentials, and Python development headers. It then upgrades pip and installs project dependencies from requirements.txt. Finally, it tests the installation by running the server with a version check. ```bash $ git clone https://github.com/malwaredllc/byob.git $ cd byob/byob/ # First, Python3 $ apt install python3.6 # 3.7, 3.8, 3.9 should also work # Pip and OpenCV are also required $ apt install python3-pip python3-opencv # Tools to compile some packages like cryptonight and pyrx $ apt install cmake build-essential python3-dev # Upgrade Pip and install its tools $ python3 -m pip install --upgrade pip setuptools wheel # Finally, install all the requirements $ python3 -m pip install -r requirements.txt # Try if everything worked $ python3 server.py --version # Should print a float number (0.5, for example) ``` -------------------------------- ### Basic Shell Script Example Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/shell/index.html A sample shell script demonstrating basic commands including cloning a git repository, generating HTTPS credentials, and starting a server. This script is intended for execution in a bash environment. ```shell #!/bin/bash # clone the repository git clone http://github.com/garden/tree # generate HTTPS credentials cd tree openssl genrsa -aes256 -out https.key 1024 openssl req -new -nodes -key https.key -out https.csr openssl x509 -req -days 365 -in https.csr -signkey https.key -out https.crt cp https.key{,.orig} openssl rsa -in https.key.orig -out https.key # start the server in HTTPS mode cd web sudo node ../server.js 443 'yes' >> ../node.log & # here is how to stop the server for pid in `ps aux | grep 'node ../server.js' | awk '{print $2}'` ; do sudo kill -9 $pid 2> /dev/null done exit 0 ``` -------------------------------- ### Install Easy Pie Chart with Bower Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/easy-pie-chart/docs/get-started.md Demonstrates how to install the easy pie chart component using the Bower package manager. This is a simple command-line installation process. ```bash $ bower install jquery.easy-pie-chart ``` -------------------------------- ### Install BYOB CLI on macOS Source: https://github.com/malwaredllc/byob/blob/master/byob/README.md Installs BYOB CLI on macOS using the Homebrew package manager. It clones the repository, updates brew, installs Python 3 and pip, and CMake. It then upgrades pip and installs project dependencies from requirements.txt. Finally, it tests the installation by running the server with a version check. ```bash $ git clone https://github.com/malwaredllc/byob.git $ cd byob/byob/ # Update Brew formulas $ brew update # Install latest Python3 version, along with Pip $ brew install python # Tools to compile some packages like cryptonight and pyrx $ brew install cmake # Upgrade Pip and install its tools $ python3 -m pip install --upgrade pip setuptools wheel # Finally, install all the requirements $ python3 -m pip install -r requirements.txt # Try if everything worked $ python3 server.py --version # Should print a float number (0.5, for example) ``` -------------------------------- ### Include CodeMirror Core, CSS, and a Language Mode Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/doc/manual.html This snippet demonstrates the basic setup for using CodeMirror by including the core JavaScript file, the CSS stylesheet, and a specific language mode (JavaScript in this example). These files are essential for initializing and rendering a CodeMirror editor on a webpage. ```html ``` -------------------------------- ### OCaml Graphics Example: Triangle Rendering with Glut Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/mllike/index.html An OCaml code snippet demonstrating basic 3D graphics rendering using the Glut library. It initializes OpenGL, sets up a display mode, creates a window, and defines a render function to draw a rotating triangle. Requires Glut library to be installed. ```ocaml let () = ignore( Glut.init Sys.argv ); Glut.initDisplayMode ~double_buffer:true (); ignore (Glut.createWindow ~title:"OpenGL Demo"); let angle t = 10. *. t *. t in let render () = GlClear.clear [ `color ]; GlMat.load_identity (); GlMat.rotate ~angle: (angle (Sys.time ())) ~z:1. (); GlDraw.begins `triangles; List.iter GlDraw.vertex2 [-1., -1.; 0., 1.; 1., -1.]; GlDraw.ends (); Glut.swapBuffers () in GlMat.mode `modelview; Glut.displayFunc ~cb:render; Glut.idleFunc ~cb:(Some Glut.postRedisplay); Glut.mainLoop () ``` -------------------------------- ### Install Dependencies and Run Tests Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/jquery-terminal/CONTRIBUTING.md Commands to install project dependencies and run automated tests. This ensures code integrity before submitting changes. ```bash npm install make test ``` -------------------------------- ### YAML Syntax Examples Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/yaml/index.html A collection of YAML syntax examples showcasing various structures including lists, indented blocks, inline blocks, and complex data with anchors and aliases. These examples illustrate common YAML patterns. ```yaml ---\n# Favorite movies - Casablanca - North by Northwest - The Man Who Wasn't There --- ``` ```yaml --- # Shopping list [milk, pumpkin pie, eggs, juice] --- ``` ```yaml --- # Indented Blocks, common in YAML data files, use indentation and new lines to separate the key: value pairs name: John Smith age: 33 --- ``` ```yaml --- # Inline Blocks, common in YAML data streams, use commas to separate the key: value pairs between braces {name: John Smith, age: 33} --- ``` ```yaml --- receipt: Oz-Ware Purchase Invoice date: 2007-08-06 customer: given: Dorothy family: Gale items: - part_no: A4786 descrip: Water Bucket (Filled) price: 1.47 quantity: 4 - part_no: E1628 descrip: High Heeled "Ruby" Slippers size: 8 price: 100.27 quantity: 1 bill-to: &id001 street: | 123 Tornado Alley Suite 16 city: East Centerville state: KS ship-to: *id001 specialDelivery: > Follow the Yellow Brick Road to the Emerald City. Pay no attention to the man behind the curtain. --- ``` -------------------------------- ### Generate BYOB Client Source: https://github.com/malwaredllc/byob/blob/master/byob/README.md Generates a BYOB client payload. It requires the server's host and port as arguments. Optionally, specific post-exploitation modules can be listed to reduce the payload's memory footprint. The generated client includes a dropper, stager, and payload. ```python python3 client.py [modules] ``` ```python python3 client.py 127.0.0.1 1337 ``` -------------------------------- ### TOML Example Syntax Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/toml/index.html This snippet showcases the basic syntax and features of the TOML configuration file format. It includes examples of key-value pairs, nested tables, arrays, and dates. ```toml # This is a TOML document. Boom. title = "TOML Example" [owner] name = "Tom Preston-Werner" organization = "GitHub" bio = "GitHub Cofounder & CEO\nLikes tater tots and beer." dob = 1979-05-27T07:32:00Z # First class dates? Why not? [database] server = "192.168.1.1" ports = [ 8001, 8001, 8002 ] connection_max = 5000 enabled = true [servers] # You can indent as you please. Tabs or spaces. TOML don't care. [servers.alpha] ip = "10.0.0.1" dc = "eqdc10" [servers.beta] ip = "10.0.0.2" dc = "eqdc10" [clients] data = [ ["gamma", "delta"], [1, 2] ] # Line breaks are OK when inside arrays hosts = [ "alpha", "omega" ] ``` -------------------------------- ### Asterisk Dialplan Configuration Example Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/asterisk/index.html A comprehensive example of an Asterisk extensions.conf file, demonstrating various dialplan contexts, extensions, macros, and commands. This serves as a practical reference for understanding Asterisk dialplan syntax and functionality. ```asterisk ; extensions.conf - the Asterisk dial plan ; ; [general] ; ; If static is set to no, or omitted, then the pbx_config will rewrite ; ; this file when extensions are modified. Remember that all comments ; ; made in the file will be lost when that happens. static=yes #include "/etc/asterisk/additional_general.conf" [iaxprovider] switch => IAX2/user:[key]@myserver/mycontext [dynamic] #exec /usr/bin/dynamic-peers.pl [trunkint] ; International long distance through trunk ; exten => _9011.,1,Macro(dundi-e164,${EXTEN:4}) exten => _9011.,n,Dial(${GLOBAL(TRUNK)}/${FILTER(0-9,${EXTEN:${GLOBAL(TRUNKMSD)}})}) [local] ; Master context for local, toll-free, and iaxtel calls only ; ignorepat => 9 include => default [demo] include => stdexten ; We start with what to do when a call first comes in. ; exten => s,1,Wait(1) ; Wait a second, just for fun same => n,Answer ; Answer the line same => n,Set(TIMEOUT(digit)=5) ; Set Digit Timeout to 5 seconds same => n,Set(TIMEOUT(response)=10) ; Set Response Timeout to 10 seconds same => n(restart),BackGround(demo-congrats) ; Play a congratulatory message same => n(instruct),BackGround(demo-instruct) ; Play some instructions same => n,WaitExten ; Wait for an extension to be dialed. exten => 2,1,BackGround(demo-moreinfo) ; Give some more information. exten => 2,n,Goto(s,instruct) exten => 3,1,Set(LANGUAGE()=fr) ; Set language to french exten => 3,n,Goto(s,restart) ; Start with the congratulations exten => 1000,1,Goto(default,s,1) ; We also create an example user, 1234, who is on the console and has ; ; voicemail, etc. ; exten => 1234,1,Playback(transfer,skip) ; "Please hold while..." ; (but skip if channel is not up) exten => 1234,n,Gosub(${EXTEN},stdexten(${GLOBAL(CONSOLE)})) exten => 1234,n,Goto(default,s,1) ; exited Voicemail exten => 1235,1,Voicemail(1234,u) ; Right to voicemail exten => 1236,1,Dial(Console/dsp) ; Ring forever exten => 1236,n,Voicemail(1234,b) ; Unless busy ; # for when they're done with the demo ; exten => #,1,Playback(demo-thanks) ; "Thanks for trying the demo" exten => #,n,Hangup ; Hang them up. ; A timeout and "invalid extension rule" ; exten => t,1,Goto(#,1) ; If they take too long, give up exten => i,1,Playback(invalid) ; "That's not valid, try again" ; Create an extension, 500, for dialing the ; ; Asterisk demo. ; exten => 500,1,Playback(demo-abouttotry); Let them know what's going on exten => 500,n,Dial(IAX2/guest@pbx.digium.com/s@default) ; Call the Asterisk demo exten => 500,n,Playback(demo-nogo) ; Couldn't connect to the demo site exten => 500,n,Goto(s,6) ; Return to the start over message. ; Create an extension, 600, for evaluating echo latency. ; exten => 600,1,Playback(demo-echotest) ; Let them know what's going on exten => 600,n,Echo ; Do the echo test exten => 600,n,Playback(demo-echodone) ; Let them know it's over exten => 600,n,Goto(s,6) ; Start over ; You can use the Macro Page to intercom a individual user exten => 76245,1,Macro(page,SIP/Grandstream1) ; or if your peernames are the same as extensions exten => _7XXX,1,Macro(page,SIP/${EXTEN}) ; System Wide Page at extension 7999 ; exten => 7999,1,Set(TIMEOUT(absolute)=60) exten => 7999,2,Page(Local/Grandstream1@page&Local/Xlite1@page&Local/1234@page/n) ; Give voicemail at extension 8500 ; exten => 8500,1,VoicemailMain exten => 8500,n,Goto(s,6) ``` -------------------------------- ### Basic Date Range Picker Initialization with Callback Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/daterangepicker/examples.html Initializes a date range picker with default options and a callback function that logs the selected start date, end date, and label to the console. This is the most fundamental usage. ```javascript $(document).ready(function() { $('#reservation').daterangepicker(null, function(start, end, label) { console.log(start.toISOString(), end.toISOString(), label); }); }); ``` -------------------------------- ### OCaml Code Examples: Sum, Quicksort, Fibonacci, Birthday Paradox, Church Numerals, Functions, Memory Management, Polymorphism, Imperative Features Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/mllike/index.html A comprehensive collection of OCaml code snippets demonstrating fundamental programming concepts. Includes examples for recursion, list manipulation, sorting, array operations, and basic function definitions. No external dependencies are required for these examples. ```ocaml (\* Summing a list of integers *) let rec sum xs = match xs with | [] -> 0 | x :: xs' -> x + sum xs' (* Quicksort *) let rec qsort = function | [] -> [] | pivot :: rest -> let is_less x = x < pivot in let left, right = List.partition is_less rest in qsort left @ [pivot] @ qsort right (* Fibonacci Sequence *) let rec fib_aux n a b = match n with | 0 -> a | _ -> fib_aux (n - 1) (a + b) a let fib n = fib_aux n 0 1 (* Birthday paradox *) let year_size = 365. let rec birthday_paradox prob people = let prob' = (year_size -. float people) /. year_size *. prob in if prob' < 0.5 then Printf.printf "answer = %d\n" (people+1) else birthday_paradox prob' (people+1) ;; birthday_paradox 1.0 1 (* Church numerals *) let zero f x = x let succ n f x = f (n f x) let one = succ zero let two = succ (succ zero) let add n1 n2 f x = n1 f (n2 f x) let to_string n = n (fun k -> "S" ^ k) "0" let _ = to_string (add (succ two) two) (* Elementary functions *) let square x = x * x;; let rec fact x = if x <= 1 then 1 else x * fact (x - 1);; (* Automatic memory management *) let l = 1 :: 2 :: 3 :: [] in; [1; 2; 3];; 5 :: l;; (* Polymorphism: sorting lists *) let rec sort = function | [] -> [] | x :: l -> insert x (sort l) and insert elem = function | [] -> [elem] | x :: l -> if elem < x then elem :: x :: l else x :: insert elem l;; (* Imperative features *) let add_polynom p1 p2 = let n1 = Array.length p1 and n2 = Array.length p2 in let result = Array.create (max n1 n2) 0 in for i = 0 to n1 - 1 do result.(i) <- p1.(i) done; for i = 0 to n2 - 1 do result.(i) <- result.(i) + p2.(i) done; result;; add_polynom [| 1; 2 |] [| 1; 2; 3 |];; (* We may redefine fact using a reference cell and a for loop *) let fact n = let result = ref 1 in for i = 2 to n do result := i * !result done; !result;; fact 5;; ``` -------------------------------- ### Smalltalk Code Example Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/smalltalk/index.html A basic Smalltalk code snippet demonstrating a counter component in Seaside. This example shows how to define a class, its state, and its rendering logic. ```smalltalk " This is a test of the Smalltalk code " Seaside.WAComponent subclass: #MyCounter [ | count | MyCounter class >> canBeRoot ^true initialize super initialize. count := 0. states ^{ self } renderContentOn: html html heading: count. html anchor callback: [ count := count + 1 ]; with: '++'. html space. html anchor callback: [ count := count - 1 ]; with: '--'. ] MyCounter registerAsApplication: 'mycounter' ``` -------------------------------- ### SPARQL Query Example Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/sparql/index.html A sample SPARQL query demonstrating syntax for selecting data, using prefixes, and filtering results. This serves as an example of the language supported by the CodeMirror SPARQL mode. ```sparql PREFIX a: PREFIX dc: PREFIX foaf: # Comment! SELECT ?given ?family WHERE { ?annot a:annotates . ?annot dc:creator ?c . OPTIONAL {?c foaf:given ?given ; foaf:family ?family } . FILTER isBlank(?c) } ``` -------------------------------- ### Install jQuery Terminal (Bower) Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/jquery-terminal/README.md This command demonstrates how to install the jQuery Terminal library using the Bower package manager. Bower is a front-end package manager for the web. ```bash bower install jquery.terminal ``` -------------------------------- ### Build Cross-Compilation Environment Source: https://github.com/malwaredllc/byob/blob/master/byob/crosscomp/README.md This script sets up the necessary build environment for cross-compilation. It installs dependencies and builds required Docker containers. It is recommended to run this script with sudo or as root. ```bash sudo bash build-environment.sh ``` -------------------------------- ### Dockerfile for BYOB Web GUI Source: https://github.com/malwaredllc/byob/wiki/Running-Web-GUI-in-a-Docker-container This Dockerfile sets up an Ubuntu environment, installs build tools, Python, and necessary packages for the BYOB Web GUI. It clones the repository, installs Python dependencies, and exposes ports for the application. Cross-compilation within this container is not supported. ```Dockerfile FROM ubuntu:bionic WORKDIR /app RUN apt-get update && \ apt-get upgrade -y && \ apt-get install -y build-essential git cmake && \ apt-get install -y python3.6 python3-pip RUN git clone https://github.com/malwaredllc/byob.git . && \ rm -rf .github .gitattributes .gitignore .travis.yml LICENSE README.md WORKDIR /app/web-gui RUN python3.6 -m pip install pip --upgrade && \ python3.6 -m pip install -r requirements.txt && \ rm -rf .gitignore .travis.yml README.md requirements.txt startup.sh docker-pyinstaller* EXPOSE 5000 1337 1338 1339 ENTRYPOINT ["python3.6", "run.py"] ``` -------------------------------- ### R Examples: Lists, Functions, and Return Values Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/r/index.html This snippet provides examples of fundamental R programming concepts including creating lists, defining functions with arguments and default values, and functions that return multiple objects using lists. It also shows a more compact way to define such functions. ```r # FIRST LEARN ABOUT LISTS -- X = list(height=5.4, weight=54) print("Use default printing --") print(X) print("Accessing individual elements --") cat("Your height is ", X$height, " and your weight is ", X$weight, "\n") # FUNCTIONS -- square <- function(x) { return(x*x) } c at("The square of 3 is ", square(3), "\n") # default value of the arg is set to 5. cube <- function(x=5) { return(x*x*x); } c at("Calling cube with 2 : ", cube(2), "\n") # will give 2^3 c at("Calling cube : ", cube(), "\n") # will default to 5^3. # LEARN ABOUT FUNCTIONS THAT RETURN MULTIPLE OBJECTS -- powers <- function(x) { parcel = list(x2=x*x, x3=x*x*x, x4=x*x*x*x); return(parcel); } X = powers(3); print("Showing powers of 3 --"); print(X); # WRITING THIS COMPACTLY (4 lines instead of 7) powerful <- function(x) { return(list(x2=x*x, x3=x*x*x, x4=x*x*x*x)); } print("Showing powers of 3 --"); print(powerful(3)); # In R, the last expression in a function is, by default, what is # returned. So you could equally just say: powerful <- function(x) {list(x2=x*x, x3=x*x*x, x4=x*x*x*x)} ``` -------------------------------- ### TypeScript Greeter Class Example Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/javascript/typescript.html A simple TypeScript class demonstrating basic class definition, constructor, and method usage. This example is often used in conjunction with code editors to showcase syntax highlighting and language features. ```typescript class Greeter { greeting: string; constructor (message: string) { this.greeting = message; } greet() { return "Hello, " + this.greeting; } } var greeter = new Greeter("world"); var button = document.createElement('button') button.innerText = "Say Hello" button.onclick = function() { alert(greeter.greet()) } document.body.appendChild(button) ``` -------------------------------- ### Fortran Code Example Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/fortran/index.html An example of Fortran code demonstrating reading numbers, calculating averages (overall, positive, and negative), and printing the results. It handles dynamic allocation and deallocation of an array for points. ```fortran program average ! Read in some numbers and take the average ! As written, if there are no data points, an average of zero is returned ! While this may not be desired behavior, it keeps this example simple implicit none real, dimension(:), allocatable :: points integer :: number_of_points real :: average_points=0., positive_average=0., negative_average=0. write (*,*) "Input number of points to average:" read (*,*) number_of_points allocate (points(number_of_points)) write (*,*) "Enter the points to average:" read (*,*) points ! Take the average by summing points and dividing by number_of_points if (number_of_points > 0) average_points = sum(points) / number_of_points ! Now form average over positive and negative points only if (count(points > 0.) > 0) then positive_average = sum(points, points > 0.) / count(points > 0.) end if if (count(points < 0.) > 0) then negative_average = sum(points, points < 0.) / count(points < 0.) end if deallocate (points) ! Print result to terminal write (*,'(a,g12.4)') 'Average = ', average_points write (*,'(a,g12.4)') 'Average of positive points = ', positive_average write (*,'(a,g12.4)') 'Average of negative points = ', negative_average end program average ``` -------------------------------- ### Install System Libraries in PyInstaller Linux Docker Source: https://github.com/malwaredllc/byob/blob/master/web-gui/docker-pyinstaller/README.md Install system libraries or dependencies within the PyInstaller Linux Docker container. Uses --entrypoint to override the default command and execute custom shell commands before the entrypoint script. Replace 'wget' with the required package names. ```docker docker run -v "$(pwd):/src/" --entrypoint /bin/sh cdrx/pyinstaller-linux -c "apt-get update -y && apt-get install -y wget && /entrypoint.sh" ``` -------------------------------- ### LESS Media Queries Example Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/less/index.html Demonstrates the use of CSS media queries with different aspect ratios. These are typically used for responsive design. ```less @media screen and (device-aspect-ratio: 16/9) { } @media screen and (device-aspect-ratio: 32/18) { } @media screen and (device-aspect-ratio: 1280/720) { } @media screen and (device-aspect-ratio: 2560/1440) { } ``` -------------------------------- ### F# Code Examples: Fibonacci, Point and Color Types, List Operations Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/mllike/index.html A collection of F# code snippets illustrating basic F# syntax and features. Includes a recursive Fibonacci function, type definitions for Point and Color, and list manipulation examples using map and fold. These examples are self-contained and do not require external libraries. ```fsharp module CodeMirror.FSharp let rec fib = function | 0 -> 0 | 1 -> 1 | n -> fib (n - 1) + fib (n - 2) type Point = { x : int y : int } type Color = | Red | Green | Blue [0 .. 10] |> List.map ((+) 2) |> List.fold (fun x y -> x + y) 0 |> printf "%i" ``` -------------------------------- ### SQL Syntax Example Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/sql/index.html An example of SQL syntax supported by the CodeMirror SQL mode. This includes various data types, keywords, comments (single-line and multi-line), and variable declarations. ```sql -- SQL Mode for CodeMirror SELECT SQL_NO_CACHE DISTINCT @var1 AS `val1`, @'val2', @global.'sql_mode', 1.1 AS `float_val`, .14 AS `another_float`, 0.09e3 AS `int_with_esp`, 0xFA5 AS `hex`, x'fa5' AS `hex2`, 0b101 AS `bin`, b'101' AS `bin2`, DATE '1994-01-01' AS `sql_date`, { T "1994-01-01" } AS `odbc_date`, 'my string', _utf8'your string', N'her string', TRUE, FALSE, UNKNOWN FROM DUAL -- space needed after '--' /* multiline comment! */ LIMIT 1 OFFSET 0; ``` -------------------------------- ### Turtle Syntax Example Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/turtle/index.html This snippet showcases a basic example of Turtle syntax, a W3C Recommendation for a simple RDF vocabulary description language. It defines prefixes for common vocabularies like FOAF and GeoSPARQL and illustrates how to represent a person with their interests and location. This is representative of data that can be edited using the CodeMirror Turtle mode. ```turtle @prefix foaf: . @prefix geo: . @prefix rdf: . a foaf:Person; foaf:interest ; foaf:based_near [ geo:lat "34.0736111" ; geo:lon "-118.3994444" ] ``` -------------------------------- ### VBScript Example Code Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/vbscript/index.html A basic VBScript code snippet demonstrating constants and a subroutine. This example is intended for use within the CodeMirror VBScript mode for syntax highlighting and understanding VBScript structure. ```vbscript ' Pete Guhl ' 03-04-2012 ' ' Basic VBScript support for codemirror2 Const ForReading = 1, ForWriting = 2, ForAppending = 8 Call Sub020_PostBroadcastToUrbanAirship(strUserName, strPassword, intTransmitID, strResponse) If Not IsNull(strResponse) AND Len(strResponse) = 0 Then boolTransmitOkYN = False Else ' WScript.Echo "Oh Happy Day! Oh Happy DAY!" boolTransmitOkYN = True End If End Call ``` -------------------------------- ### Dockerfile for BYOB C2 Server Image Source: https://github.com/malwaredllc/byob/wiki/Running-Console-Application-in-a-Docker-container This Dockerfile sets up an Ubuntu environment, installs necessary dependencies like git and Python, clones the BYOB repository, installs Python packages, and configures the entrypoint to run the C2 server. It exposes ports 8080, 8081, and 8082. ```Dockerfile FROM ubuntu:bionic WORKDIR /app RUN apt-get update && \ apt-get upgrade -y && \ apt-get install -y git python2.7 python-pip RUN git clone https://github.com/malwaredllc/byob.git . && \ rm -rf .github .gitattributes .gitignore .travis.yml LICENSE README.md WORKDIR /app/byob RUN python setup.py && \ pip install colorama EXPOSE 8080 8081 8082 ENTRYPOINT ["python", "server.py", "--port", "8080"] ``` -------------------------------- ### Perl Syntax Example Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/perl/index.html Demonstrates basic Perl syntax, including variable declarations, string manipulation, regular expressions, and embedded HTML. ```perl #!/usr/bin/perl use Something qw(func1 func2); # strings my $s1 = qq'single line'; our $s2 = q(multi- line); =item Something Example. =cut my $html=<<'HTML' hi! HTML print "first,".join(',', 'second', qq~third~); if($s1 =~ m\[(?{$1}=$$.' predefined variables'; $s2 =~ s/\\-line//ox; $s1 =~ s\[ line \] \[ block \]ox; } 1; # numbers and comments __END__ something... ``` -------------------------------- ### Jinja2 and HTML Example Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/jinja2/index.html An example demonstrating Jinja2 template syntax embedded within an HTML structure. This snippet showcases comments, loops, and variable output within a basic HTML document. It serves as a visual representation of how Jinja2 is used with HTML. ```html Jinja2 Example
    {# this is a comment #} {%- for item in li -%}
  • {{ item.label }}
  • {% endfor -%}
``` -------------------------------- ### Initialization with Options Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/doc/manual.html Shows how to initialize a CodeMirror editor with specific configurations, such as initial value and mode. ```APIDOC ## Basic Usage with Options ### Description Initializes a CodeMirror editor instance with a specified initial value and mode. ### Method `CodeMirror(parentNode, [options])` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **parentNode** (Element|Function) - The DOM element to append the editor to, or a function that inserts the editor into the document. * **options** (Object) - Optional. Configuration options for the editor. * **value** (string|CodeMirror.Doc) - The starting value of the editor. * **mode** (string|object) - The language mode for the editor. ### Request Example ```javascript var myCodeMirror = CodeMirror(document.body, { value: "function myScript(){\n return 100;\n}", mode: "javascript" }); ``` ### Response #### Success Response (200) Returns a CodeMirror editor instance. #### Response Example ```javascript // CodeMirror editor instance ``` -------------------------------- ### Easy Pie Chart with Vanilla JS Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/easy-pie-chart/docs/get-started.md Provides an example of using the Easy Pie Chart plugin without any dependencies, using plain JavaScript. It includes the necessary HTML structure and script to instantiate the chart directly. ```html
73%
``` -------------------------------- ### Get Viewport Information Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/doc/manual.html Retrieves the start (inclusive) and end (exclusive) line numbers of the currently rendered portion of the document. This is useful for optimizing rendering in large documents. ```typescript cm.getViewport() → {from: number, to: number} ``` -------------------------------- ### Get Text Range - JavaScript Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/doc/manual.html Extracts the text content within a specified range defined by start and end points ({line, ch} objects). An optional line separator can be specified. ```javascript editor.getRange({line: 0, ch: 0}, {line: 1, ch: 5}); editor.getRange({line: 2, ch: 0}, {line: 3, ch: 10}, "---"); // Using '---' as separator ``` -------------------------------- ### Basic Initialization Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/doc/manual.html Demonstrates the simplest way to initialize a CodeMirror editor instance, appending it to the document body. ```APIDOC ## Basic Usage ### Description Initializes a CodeMirror editor instance and appends it to the document body. ### Method `CodeMirror(parentNode, [options])` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **parentNode** (Element|Function) - The DOM element to append the editor to, or a function that inserts the editor into the document. * **options** (Object) - Optional. Configuration options for the editor. ### Request Example ```javascript var myCodeMirror = CodeMirror(document.body); ``` ### Response #### Success Response (200) Returns a CodeMirror editor instance. #### Response Example ```javascript // CodeMirror editor instance ``` -------------------------------- ### Execute BYOB Client Payload Source: https://github.com/malwaredllc/byob/blob/master/byob/README.md Executes a generated BYOB client payload. This action connects the client to the server, enabling remote control and module execution. The payload is typically found in the modules/clients/payloads/ directory. ```python python3 .py ``` -------------------------------- ### Initialize and Update EasyPieChart with Vanilla JS Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/easy-pie-chart/demo/index.html This snippet shows how to initialize an EasyPieChart with specific easing and color configurations. It also includes an event listener to update the chart dynamically when a button is clicked. Dependencies include the EasyPieChart library. ```javascript document.addEventListener('DOMContentLoaded', function() { var chart = window.chart = new EasyPieChart(document.querySelector('span'), { easing: 'easeOutElastic', delay: 3000, barColor: '#69c', trackColor: '#ace', scaleColor: false, lineWidth: 20, trackWidth: 16, lineCap: 'butt', onStep: function(from, to, percent) { this.el.children[0].innerHTML = Math.round(percent); } }); document.querySelector('.js_update').addEventListener('click', function(e) { chart.update(Math.random()*200-100); }); }); ``` -------------------------------- ### JavaScript: CodeMirror Event Handling Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/doc/upgrade_v3.html This example shows the updated event handling mechanism in CodeMirror 3. Instead of `onXYZ` options, the `on` method is used to register event listeners. This allows for multiple handlers per event and supports object-level event registration. The `change` event is demonstrated. ```javascript cm.on("change", function(cm, change) { console.log("something changed! (" + change.origin + ")"); }); ``` -------------------------------- ### Configuration Options Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/doc/manual.html Details the various configuration options available when initializing a CodeMirror editor, including value, mode, and defaults. ```APIDOC ## Configuration ### Description Explains the configuration options that can be passed during CodeMirror editor initialization. Options not provided are taken from `CodeMirror.defaults`. ### Method `CodeMirror(parentNode, options)` or `CodeMirror.fromTextArea(textArea, options)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **options** (Object) - An object containing configuration options. * **value** (string|CodeMirror.Doc) - The starting value of the editor. * **mode** (string|object) - The language mode for syntax highlighting and indentation. * **... (other options)** - Refer to CodeMirror documentation for a full list of options. ### Request Example ```javascript var myCodeMirror = CodeMirror(document.body, { value: "Initial content", mode: "css", lineNumbers: true }); ``` ### Response #### Success Response (200) Configuration applied to the CodeMirror instance. #### Response Example ```json { "status": "Configuration applied" } ``` ``` -------------------------------- ### Configure Date Range Picker with Options and Callback Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/daterangepicker/README.md This example shows how to initialize the Date Range Picker with custom options, such as date format and initial range, and includes a callback function that executes when the date range is selected. The callback receives start date, end date, and the label of the chosen predefined range. ```javascript $'input[name="daterange"]').daterangepicker( { format: 'YYYY-MM-DD', startDate: '2013-01-01', endDate: '2013-12-31' }, function(start, end, label) { alert('A date range was chosen: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD')); } ); ``` -------------------------------- ### JavaScript: CodeMirror Folding with markText Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/doc/upgrade_v3.html This example shows how line folding is now achieved using the `markText` method in CodeMirror 3. It demonstrates folding a range of lines and replacing them with placeholder text, with an option to automatically unfold when the cursor enters the range. Event listeners can be attached to the marked range for actions like auto-unfolding. ```javascript var range = cm.markText({line: 4, ch: 2}, {line: 8, ch: 1}, { replacedWith: document.createTextNode("??"), // Auto-unfold when cursor moves into the range clearOnEnter: true }); // Get notified when auto-unfolding CodeMirror.on(range, "clear", function() { console.log("boom"); }); ``` -------------------------------- ### JavaScript Tern Server Setup and Editor Integration Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/demo/tern.html Initializes a Tern server with ECMAScript 5 definitions and configures CodeMirror editor key bindings for Tern features. It fetches definitions from a URL and sets up event listeners for cursor activity. ```javascript function getURL(url, c) { var xhr = new XMLHttpRequest(); xhr.open("get", url, true); xhr.send(); xhr.onreadystatechange = function() { if (xhr.readyState != 4) return; if (xhr.status < 400) return c(null, xhr.responseText); var e = new Error(xhr.responseText || "No response"); e.status = xhr.status; c(e); }; } var server; getURL("http://ternjs.net/defs/ecma5.json", function(err, code) { if (err) throw new Error("Request for ecma5.json: " + err); server = new CodeMirror.TernServer({ defs: [JSON.parse(code)] }); editor.setOption("extraKeys", { "Ctrl-Space": function(cm) { server.complete(cm); }, "Ctrl-I": function(cm) { server.showType(cm); }, "Alt-.": function(cm) { server.jumpToDef(cm); }, "Alt-,": function(cm) { server.jumpBack(cm); }, "Ctrl-Q": function(cm) { server.rename(cm); }, }) editor.on("cursorActivity", function(cm) { server.updateArgHints(cm); }); }); var editor = CodeMirror.fromTextArea(document.getElementById("code"), { lineNumbers: true, mode: "javascript" }); ``` -------------------------------- ### Initialize FullCalendar with Events (JavaScript) Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/fullcalendar-2/demos/agenda-views.html This snippet initializes the FullCalendar plugin on an HTML element with the ID 'calendar'. It configures the calendar's header, sets a default date, enables event editing, limits the number of events displayed, and populates the calendar with an array of event objects. Each event object can include properties like title, start, end, id, and url. ```javascript $(document).ready(function() { $('#calendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, defaultDate: '2014-11-12', editable: true, eventLimit: true, // allow "more" link when too many events events: [ { title: 'All Day Event', start: '2014-11-01' }, { title: 'Long Event', start: '2014-11-07', end: '2014-11-10' }, { id: 999, title: 'Repeating Event', start: '2014-11-09T16:00:00' }, { id: 999, title: 'Repeating Event', start: '2014-11-16T16:00:00' }, { title: 'Conference', start: '2014-11-11', end: '2014-11-13' }, { title: 'Meeting', start: '2014-11-12T10:30:00', end: '2014-11-12T12:30:00' }, { title: 'Lunch', start: '2014-11-12T12:00:00' }, { title: 'Meeting', start: '2014-11-12T14:30:00' }, { title: 'Happy Hour', start: '2014-11-12T17:30:00' }, { title: 'Dinner', start: '2014-11-12T20:00:00' }, { title: 'Birthday Party', start: '2014-11-13T07:00:00' }, { title: 'Click for Google', url: 'http://google.com/', start: '2014-11-28' } ] }); }); ``` -------------------------------- ### Initialization from Textarea Source: https://github.com/malwaredllc/byob/blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/doc/manual.html Provides a shortcut to replace a textarea element with a CodeMirror editor, automatically handling form submission updates. ```APIDOC ## Initialization from Textarea ### Description Replaces a textarea element with a CodeMirror editor instance. This method also handles updating the textarea's value on form submission. ### Method `CodeMirror.fromTextArea(textArea, [options])` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **textArea** (HTMLTextAreaElement) - The textarea element to replace. * **options** (Object) - Optional. Configuration options for the editor. ### Request Example ```javascript var myTextArea = document.getElementById('my-text-area'); var myCodeMirror = CodeMirror.fromTextArea(myTextArea); ``` ### Response #### Success Response (200) Returns a CodeMirror editor instance. #### Response Example ```javascript // CodeMirror editor instance ```