Skip to content

Instantly share code, notes, and snippets.

@savon-noir
savon-noir / tor-exit-nodes-parser.py
Created October 27, 2015 17:11
Pyton parser for TOR exit nodes published list
# -*- coding: utf-8 -*-
#
# get file from https://check.torproject.org/exit-addresses
def parse_torexitnodes(fileobj):
torlist = []
btemplate = {
'nodename': '',
'create_date': '',
'last_update': '',
@savon-noir
savon-noir / keybase.md
Last active August 29, 2015 14:25
keybase.io github proof

Keybase proof

I hereby claim:

  • I am savon-noir on github.
  • I am ronaldb (https://keybase.io/ronaldb) on keybase.
  • I have a public key whose fingerprint is CA8A 6456 24D5 4B8B D302 FB0C 2DDF 8B7D 9A96 E85E

To claim this, I am signing this object:

from libnmap.parser import NmapParser
p = NmapParser.parse_fromfile("<path to the result of command>.xml")
for host in p.hosts:
for service in host.services:
for script_output in service.scripts_results:
print "Output of {0}: {1}".format(script_output['id'], script_output['output'])
@savon-noir
savon-noir / cpelist
Created May 14, 2014 17:07
NmapService.cpelist
In [1]: from libnmap.parser import NmapParser
In [2]: p = NmapParser.parse_fromfile('libnmap/test/files/fullscan.xml')
In [3]: h = p.hosts.pop()
In [4]: s = h.services[2]
In [5]: for s in h.services:
for cpe in s.cpelist:
@savon-noir
savon-noir / gist:0fb9307f7d69a2d93d9b
Created May 5, 2014 16:36
New OS fingerprint API for libnmap
In [1]: from libnmap.parser import NmapParser
In [2]: p = NmapParser.parse_fromfile('/root/all6.nmap')
In [3]: h = p.hosts.pop()
In [4]: print h.os
Linux 3.7 - 3.9: 98
|__ os class: general purpose: Linux, Linux(3.X)
|__ cpe:/o:linux:linux_kernel:3
Netgear DG834G WAP or Western Digital WD TV media player: 95
|__ os class: WAP: Netgear, embedded
@savon-noir
savon-noir / gist:65f1d3efb950e0fc28c1
Created May 2, 2014 16:43
python-libnmap.v0.4.7: new NmapProcess with NmapTask support
(pydev)vagrant@devbox:~/fork/python-libnmap/libnmap$ python process.py
Task Ping Scan (started): ETC: 0 DONE: 0%
Task Ping Scan (started): ETC: 1399047911 DONE: 50.00%
Task Ping Scan (started): ETC: 1399047913 DONE: 50.00%
Task Ping Scan (started): ETC: 1399047913 DONE: 75.00%
Task Ping Scan (ended): ETC: 1399047913 DONE: 75.00%
Task Parallel DNS resolution of 1 host. (started): ETC: 0 DONE: 0%
Task Parallel DNS resolution of 1 host. (ended): ETC: 0 DONE: 0%
Task Connect Scan (started): ETC: 0 DONE: 0%
Task Connect Scan (started): ETC: 1399048212 DONE: 1.00%
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@savon-noir
savon-noir / gist:5795363
Created June 17, 2013 08:09
NmapReport.__ne__ and NmapReport.__eq__ alternative
def __ne__(self, other):
rval = True
if(self.__class__ == other.__class__ and self.id == other.id):
diffobj = self.diff(other)
rval = (len(diffobj.changed()) != 0 or
len(diffobj.added()) != 0 or
len(diffobj.removed()) != 0
)
return rval
>>>>>>>>>>>>>>>>>
@savon-noir
savon-noir / gist:5760912
Created June 11, 2013 21:32
small jsfiddle
http://jsfiddle.net/CJxAk/3/
#!/usr/bin/env python
from libnmap.parser import NmapParser
def nested_obj(objname):
rval = None
splitted = objname.split("::")
if len(splitted) == 2:
rval = splitted