xct's notes
Search…
Other

Randomized Curl Portscan Scan

1
a=( $(shuf -e $(seq 20000 60000)) )
2
for i in ${a[@]}; do curl -v -k https://<target>:$i -m 1;done | tee out
Copied!

Port Java Code to NodeJS

1
node> password = "jU5t_a_sna_3lpm1dg347_u_4_mfr54b"> var i;> var buffer = Array(32);> for (i=0; i<8; i++) {... buffer[i] = password.charAt(i);... }> for (; i<16; i++) {... buffer[i] = password.charAt(23-i);... }> for (; i<32; i+=2) {... buffer[i] = password.charAt(46-i);... }> for (i=31; i>=17; i-=2) {... buffer[i] = password.charAt(i);... }> console.log("picoCTF{" + buffer.join("") + "}");
Copied!

​Convert colored terminal output to image

1
#!/usr/bin/env python2
2
from pwn import *
3
from subprocess import check_output
4
import subprocess
5
6
p = remote('RHOST',RPORT)
7
img = p.recvuntil("[+]")
8
print(img)
9
subprocess.call("gnome-screenshot -f x.png", shell=True)
10
p.interactive()
Copied!

Initrd

1
zcat <image> | cpio -idmv
Copied!

CTF Proof of Work

Quick way to solve proof of work challenges that require you to find an input that hashes to a certain hash:
1
work = b"aaaaaa"
2
magic = iters.mbruteforce(lambda x: hashlib.sha256(x.encode()).hexdigest()[:len(work)].encode() == work, string.ascii_lowercase, 6)
Copied!

Basic Reverse Shell Script

Powershell Fileupload with Kerberos Authentication

1
$FilePath = 'C:\programdata\example.txt';
2
$URL = 'http://web.test.local/Upload';
3
$fileBytes = [System.IO.File]::ReadAllBytes($FilePath);
4
$fileEnc = [System.Text.Encoding]::GetEncoding('UTF-8').GetString($fileBytes);
5
$boundary = [System.Guid]::NewGuid().ToString();
6
$LF = "`r`n";
7
8
$bodyLines = (
9
"--$boundary",
10
"Content-Disposition: form-data; name=`"file`"; filename=`"example.txt`"",
11
"Content-Type: application/octet-stream$LF",
12
$fileEnc,
13
"--$boundary--$LF"
14
) -join $LF
15
16
Invoke-RestMethod -Uri $URL -Method Post -ContentType "multipart/form-data; boundary=`"$boundary`"" -Body $bodyLines -UseDefaultCredentials;
Copied!
Last modified 3mo ago