Skip to content

Commit cef325f

Browse files
committed
New script
1 parent 23355a2 commit cef325f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1379
-0
lines changed

BannerGrabbing.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/python3
2+
__author__ = 'kilroy'
3+
# (c) 2014, WasHere Consulting, Inc.
4+
# Written for Infinite Skills
5+
6+
import socket
7+
import re
8+
9+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
10+
sock.connect(("www.microsoft.com", 80))
11+
12+
http_get = b"GET / HTTP/1.1\nHost: www.microsoft.com\n\n"
13+
data = ''
14+
try:
15+
sock.sendall(http_get)
16+
data = sock.recvfrom(1024)
17+
except socket.error:
18+
print ("Socket error", socket.errno)
19+
finally:
20+
print("closing connection")
21+
sock.close()
22+
23+
strdata = data[0].decode("utf-8")
24+
# looks like one long line so split it at newline into multiple strings
25+
headers = strdata.splitlines()
26+
# use regular expression library to look for the one line we like
27+
for s in headers:
28+
if re.search('Server:', s):
29+
s = s.replace("Server: ", "")
30+
print(s)

Conditionals.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/python3
2+
__author__ = 'kilroy'
3+
# (c) 2014, WasHere Consulting, Inc.
4+
# Written for Infinite Skills
5+
6+
# input is a string unless converted
7+
x = int(input("Give me a number "))
8+
if (x < 1):
9+
print("Too little")
10+
elif (x >= 1 and x <= 10):
11+
print("Just about right")
12+
else:
13+
print("Too high")
14+

Cookies.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/python
2+
__author__ = 'kilroy'
3+
# (c) 2014, WasHere Consulting, Inc.
4+
# Written for Infinite Skills
5+
6+
import urllib2
7+
8+
url = "https://www.google.com"
9+
request = urllib2.Request(url)
10+
resp = urllib2.urlopen(request)
11+
cookies = resp.info()['Set-Cookie']
12+
content = resp.read()
13+
resp.close()
14+
print (cookies, content)

Debugging.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/python
2+
__author__ = 'kilroy'
3+
# (c) 2014, WasHere Consulting, Inc.
4+
# Written for Infinite Skills
5+
6+
from winappdbg import *
7+
8+
with Debug ( bKillOnExit = True ) as dbg:
9+
dbg.execl("calc.exe")
10+
11+
while dbg:
12+
try:
13+
dbg.wait(1000)
14+
except Exception as e:
15+
print(e)
16+
17+
try:
18+
dbg.dispatch()
19+
finally:
20+
dbg.cont()
21+
22+
cmdDbg = Debug()
23+
cmdDbg.system.scan_processes()
24+
# let's look for cmd.exe processes
25+
for ( proc, name ) in cmdDbg.system.find_processes_by_filename( 'cmd.exe' ):
26+
# print out the process ID and the name of the process
27+
print proc.get_pid(), name

Encrypt.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/python
2+
__author__ = 'kilroy'
3+
# (c) 2014, WasHere Consulting, Inc.
4+
# Written for Infinite Skills
5+
6+
# need pycrypto package
7+
from Crypto.Cipher import AES
8+
9+
# key has to be 16, 24 or 32 bytes long
10+
cryptObj = AES.new("This is my key42", AES.MODE_CBC, "16 character vec")
11+
# notice the spaces -- that's to pad it out to a multiple of 16 bytes
12+
plaintext = "This is some text we need to encrypt because it's very secret "
13+
ciphertext = cryptObj.encrypt(plaintext)
14+
print("Cipher text: ", ciphertext)
15+
16+
# this won't work if the key isn't identical
17+
newcryptObj = AES.new("This is my key42", AES.MODE_CBC, "16 character vec")
18+
result = newcryptObj.decrypt(ciphertext)
19+
20+
print(result)

Exceptions.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/python3
2+
__author__ = 'kilroy'
3+
# (c) 2014, WasHere Consulting, Inc.
4+
# Written for Infinite Skills
5+
6+
try:
7+
fhandle = open("myfile", "w")
8+
fhandle.write("This is some data to dump into the file")
9+
print("Wrote some data to the file")
10+
except IOError as e:
11+
print("Exception caught: Unable to write to myfile ", e)
12+
except Exception as e:
13+
print("Another error occurred ", e)
14+
else:
15+
print("File written to successfully")
16+
fhandle.close()

FTP.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/python3
2+
__author__ = 'kilroy'
3+
# (c) 2014, WasHere Consulting, Inc.
4+
# Written for Infinite Skills
5+
6+
import ftplib
7+
8+
f = ftplib.FTP("172.30.42.127")
9+
10+
try:
11+
f.login("ric", "P4ssw0rd!")
12+
print(f.getwelcome())
13+
f.delete("myfile")
14+
print(f.dir())
15+
f.set_pasv(1)
16+
f.storbinary("STOR myfile", open("myfile", "rb"))
17+
print(f.dir())
18+
except Exception as e:
19+
print("Exception: ", e)
20+
finally:
21+
f.close()

Fuzzing.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/python
2+
__author__ = 'kilroy'
3+
# (c) 2014, WasHere Consulting, Inc.
4+
# Written for Infinite Skills
5+
6+
from pyfuzz.generator import *
7+
import socket
8+
9+
msg = random_ascii() + b" / HTTP/1.1\nHost: 172.30.42.114\r\n"
10+
print(msg)
11+
12+
try:
13+
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
14+
addr = ("172.30.42.114", 80)
15+
s.connect(addr)
16+
s.sendall(msg)
17+
resp = s.recv(4096)
18+
print(resp)
19+
except Exception as e:
20+
print(e)
21+
finally:
22+
s.close()

HEADRequest.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/python
2+
__author__ = 'kilroy'
3+
# (c) 2014, WasHere Consulting, Inc.
4+
# Written for Infinite Skills
5+
6+
import httplib
7+
8+
host = "172.30.42.126"
9+
10+
req = httplib.HTTP(host)
11+
req.putrequest("HEAD", "/")
12+
req.putheader("Host", host)
13+
req.endheaders()
14+
req.send("")
15+
16+
statusCode, statusMsg, headers = req.getreply()
17+
print("Status: ", statusCode)

HTMLParse.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/python
2+
__author__ = 'kilroy'
3+
# (c) 2014, WasHere Consulting, Inc.
4+
# Written for Infinite Skills
5+
6+
from HTMLParser import HTMLParser
7+
import urllib2
8+
9+
class myParser(HTMLParser):
10+
def handle_starttag(self, tag, attrs):
11+
if (tag == "input"):
12+
print("Found an input field ", tag)
13+
print(attrs)
14+
15+
url = "http://172.30.42.127/test.php"
16+
request = urllib2.Request(url)
17+
handle = urllib2.urlopen(request)
18+
parser = myParser()
19+
parser.feed(handle.read())

HTTPAuth.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/python
2+
__author__ = 'kilroy'
3+
# (c) 2014, WasHere Consulting, Inc.
4+
# Written for Infinite Skills
5+
6+
import httplib
7+
import base64
8+
import string
9+
10+
h = "172.30.42.127"
11+
u = "ric"
12+
p = "P4ssw0rd"
13+
14+
authToken = base64.encodestring('%s:%s' % (u, p)).replace('\n', '')
15+
print(authToken)
16+
17+
req = httplib.HTTP(h)
18+
req.putrequest("GET", "/protected/index.html")
19+
req.putheader("Host", h)
20+
req.putheader("Authorization", "Basic %s" % authToken)
21+
req.endheaders()
22+
req.send("")
23+
24+
statusCode, statusMsg, headers = req.getreply()
25+
print("Response: ", statusMsg)

HTTPDownload.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/python
2+
__author__ = 'kilroy'
3+
# (c) 2014, WasHere Consulting, Inc.
4+
# Written for Infinite Skills
5+
6+
import urllib
7+
8+
print("starting download")
9+
10+
urllib.urlretrieve("http://trendingmp3.com/music/user_folder/Rae%20Sremmurd%20-%20No%20Flex%20Zone.mp3", "thing.mp3")
11+
12+
print("completed")

HTTPProxy.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/python
2+
__author__ = 'kilroy'
3+
# (c) 2014, WasHere Consulting, Inc.
4+
# Written for Infinite Skills
5+
6+
import urllib2
7+
8+
proxy = urllib2.ProxyHandler({'http': '127.0.0.1:8080'})
9+
opener = urllib2.build_opener(proxy)
10+
urllib2.install_opener(opener)
11+
handle = urllib2.urlopen('http://www.microsoft.com')
12+
13+
print(handle.read())
14+

HTTPUserAgent.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/python
2+
__author__ = 'kilroy'
3+
# (c) 2014, WasHere Consulting, Inc.
4+
# Written for Infinite Skills
5+
6+
import httplib
7+
8+
h = "www.infiniteskills.com"
9+
10+
req = httplib.HTTP(h)
11+
req.putrequest("GET", "/")
12+
req.putheader("Host", h)
13+
req.putheader("User-Agent", "Garbage browser: 5.6")
14+
req.putheader("My-Header", "My value")
15+
req.endheaders()
16+
req.send("")
17+
18+
statusCode, statusMsg, headers = req.getreply()
19+
print("Response: ", statusMsg)
20+

Loops.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/python3
2+
__author__ = 'kilroy'
3+
4+
name=input("What is your name? ")
5+
6+
# for loop ... range creates a list
7+
for i in range(1,10):
8+
print (name, i)
9+
10+
# while loop using break
11+
x=0
12+
while True:
13+
print (x)
14+
x=x+1
15+
if (x==15):
16+
break
17+
18+
# for loop using a list
19+
mylist=['lions', 'tigers', 'bears', 'ohmy']
20+
for i in mylist:
21+
print(i)
22+

MBR.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/python3
2+
# (c) 2014, WasHere Consulting, Inc
3+
import struct
4+
5+
f = open("mbr.dd", "rb")
6+
7+
mbr = bytearray()
8+
try:
9+
mbr = f.read(512)
10+
finally:
11+
f.close()
12+
13+
sig = struct.unpack("<I", mbr[0x1B8:0x1BC])
14+
print("Disk signature: ", sig[0])
15+
active = mbr[0x1BE]
16+
if active == 0x80:
17+
print("Active flag: Active")
18+
else:
19+
print("Active flag: Not active")
20+
21+
lbastart = struct.unpack("<I", mbr[0x1C6:0x1CA])
22+
print("Partition Start (LBA): ", lbastart[0])
23+
lbaend = struct.unpack("<I", mbr[0x1C9:0x1CD])
24+
print("Partition End (LBA): ", lbaend[0])
25+

Multicasting.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/python3
2+
__author__ = 'kilroy'
3+
# (c) 2014, WasHere Consulting, Inc.
4+
# Written for Infinite Skills
5+
6+
import socket
7+
8+
mgrp = "224.1.1.1"
9+
mport = 5775
10+
11+
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
12+
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
13+
for i in range(1,10):
14+
sock.sendto(b"Hi, this is me", (mgrp, mport))
15+
16+
print("Message sent out to the multicast group")

NameLookups.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/python3
2+
__author__ = 'kilroy'
3+
# (c) 2014, WasHere Consulting, Inc.
4+
# Written for Infinite Skills
5+
6+
import socket
7+
8+
print(socket.gethostbyaddr("8.8.8.8"))
9+
print(socket.gethostbyname("www.google.com"))

NetworkClient.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/python3
2+
__author__ = 'kilroy'
3+
# (c) 2014, WasHere Consulting, Inc.
4+
# Written for Infinite Skills
5+
6+
import socket
7+
8+
host='localhost'
9+
10+
mysock=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
11+
addr=(host,5555)
12+
mysock.connect(addr)
13+
14+
try:
15+
msg=b"hi, this is a test\n"
16+
mysock.sendall(msg)
17+
except socket.errno as e:
18+
print("Socket error ", e)
19+
finally:
20+
mysock.close()
21+

0 commit comments

Comments
 (0)