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:4760136
Created February 12, 2013 03:59
Scan a range with nmap.
#!/usr/bin/python2
#
# DEPS: nmap, notify-send
#
import subprocess
import re
import time
import sys
import os
@hackingbutlegal
hackingbutlegal / gist:4760213
Created February 12, 2013 04:18
Python web server
import SimpleHTTPServer, SocketServer, sys
#SET THE PORT VARIABLE TO COMMAND-LINE ARGUMENT
PORT = sys.argv[1]
def RunServer():
try:
httphandler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", int(PORT)), httphandler)
@hackingbutlegal
hackingbutlegal / gist:4760216
Created February 12, 2013 04:20
Check version numbers for certain applications
#!/usr/bin/env python
import sys
import check_versions, csv_report
HOST = sys.argv[1]
USER = "jars"
PASSWORD = "jars"
def check_arguments():
@hackingbutlegal
hackingbutlegal / gist:4760219
Created February 12, 2013 04:20
Parse syslog for stuff
import syslog
print """
Enter a number and press [Enter]:
1 - Emergency
2 - Alert
3 - Critical
4 - Error
5 - Warning
6 - Notics
@hackingbutlegal
hackingbutlegal / gist:4760222
Created February 12, 2013 04:22
Windows: Check out some registry values
import _winreg
explorer = _winreg.OpenKey(
_winreg.HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer")
# list values owned by this registry key
i = 0
try:
while 1:
@hackingbutlegal
hackingbutlegal / gist:4760223
Created February 12, 2013 04:22
Windows: Manipulate services
import win32serviceutil, time
def service_info(action, machine, service):
if action == 'stop':
win32serviceutil.StopService(service, machine)
print '%s stopped successfully' % service
time.sleep(3)
elif action == 'start':
win32serviceutil.StartService(service, machine)
print '%s started successfully' % service
@hackingbutlegal
hackingbutlegal / gist:4760227
Created February 12, 2013 04:22
Windows: Get some information
import win32net
#print users
users = win32net.NetUserEnum('localhost', 0)
print "USERS"
print "=========="
for user in users[0]:
print user['name']
print ""
@hackingbutlegal
hackingbutlegal / gist:5002152
Created February 21, 2013 04:45
APT1 Batch
@echo off
ipconfig /all>>”C:\WINNT\Debug\1.txt”
net start>>”C:\WINNT\Debug\1.txt”
tasklist /v>>”C:\WINNT\Debug\1.txt”
net user >>”C:\WINNT\Debug\1.txt”
net localgroup administrators>>”C:\WINNT\Debug\1.txt”
netstat -ano>>”C:\WINNT\Debug\1.txt”
net use>>”C:\WINNT\Debug\1.txt”
net view>>”C:\WINNT\Debug\1.txt”
net view /domain>>”C:\WINNT\Debug\1.txt”
@hackingbutlegal
hackingbutlegal / gist:5027100
Created February 25, 2013 02:51
Perl script to remove protection from a PDF.
# Usage: perl invalidate-signing-certs.pl <in.pdf >out.pdf
binmode(STDIN);
binmode(STDOUT);
$/ = "\0";
while(<>) {
s#(/Perms<</DocMDP.*?>>)#' ' x length $1#ge;
s#(/Ff 1)(?=.*?/Lock )#' ' x length $1#ge;
s#(?<=/Lock)(.*?)(/Ff 1)#"$1" . ' ' x length $2#ge;
s#(/Lock .*?)(?=/)#' ' x length $1#ge;
s#( obj<<)([^>\rendobj)#$1 . (‘ ‘ x length $2) . $3#ge;
@hackingbutlegal
hackingbutlegal / gist:5027184
Created February 25, 2013 03:05
OS X: MAC address spoofing
# macbook with no ethernet port, en0 is usually airport
#
# those with ethernet port will probably use en1 for airport
#
# be sure to note the default address before beginning
# set the mac to something specific
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z
sudo ifconfig en1 ether 00:11:22:33:44:55