Skip to content

Instantly share code, notes, and snippets.

@Creased
Last active April 24, 2017 13:15
Show Gist options
  • Save Creased/a4e0fd7b1f1b30c1eb15d13fc1c29ded to your computer and use it in GitHub Desktop.
Save Creased/a4e0fd7b1f1b30c1eb15d13fc1c29ded to your computer and use it in GitHub Desktop.
Xivo provd check
#!/usr/bin/env python
# -*- coding:Utf-8 -*-
#=====================================#
# [+] Title: Xivo provd check #
# [+] Author: Baptiste M. (Creased) #
# [+] Website: bmoine.fr #
# [+] Email: [email protected] #
# [+] Twitter: @Creased_ #
#=====================================#
import struct, logging
logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
from scapy.all import *
def p(x):
return struct.pack('<L', x)
def x(s):
s = s.encode('hex')
s = [s[i:i + 2] for i in range(0, len(s), 2)]
x = ''
for c in s:
x += str('\\') + 'x' + str(c)
return x
opts = {
'verbose': 0,
'eth': {
'iface': 'eth0',
'dst': '00:50:56:9d:25:ac',
'src': '00:04:f2:bb:f6:f7'
},
'ip': {
'dst': 'xivo.miletrie.chl',
'src': '172.28.128.200'
},
'tcp': {
'sport': random.randint(1024,65535),
'dport': '8667'
},
'http': {
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0'
}
}
# conf.iface = opts['eth']['iface']
conf.verb = opts['verbose']
eth = Ether()
eth.dst = opts['eth']['dst']
eth.src = opts['eth']['src']
eth.type = 0x800
ip = IP()
ip.dst = opts['ip']['dst']
ip.src = opts['ip']['src']
ip.proto = 6
ip.flags = 'DF'
ip.ttl = 128
tcp = TCP()
tcp.sport = opts['tcp']['sport']
tcp.dport = opts['tcp']['dport']
raw = Raw()
load = 'GET /{0}.cfg HTTP/1.1\r\n'.format(''.join(opts['eth']['src'].split(':')))
load += 'Host: {0}:{1}\r\n'.format(opts['ip']['dst'], opts['tcp']['dport'])
load += 'User-Agent: {0}\r\n'.format(opts['http']['user-agent'])
load += 'Connection: close\r\n'
load += '\r\n'
raw.load = load
packet = eth/ip/tcp/raw
packet.show()
reply = sendp(packet)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment