All,
I am no developer and burned a couple hours on the making custom commands docs and conf sessions and feel like I am no closer. So hoping someone can give me a basic template to wrap this in?
Basically I have this script (works on python 2 and 3 unchanged). I'd like to pass my custom command a value which is a securitycode and return the value from my script. How can I get this done? Anyone have a template?
#!/usr/bin/env python3.5
import sys
hsh = [
(1 , 'Known Violators'),
(2 , 'Blocked Country'),
(4 , 'Browser Integrity Check'),
(8 , 'Known Violator User Agent'),
(16 , 'Rate Limited'),
(32 , 'Known Violator Honeypot Access'),
(64 , 'Referrer Block'),
(128 , 'Session Length Exceeded'),
(256 , 'Pages Per Session Exceeded'),
(512 , 'Bad User Agents'),
(1024 , 'Aggregator User Agents'),
(2048 , 'Filtered IP'),
(4096 , 'JavaScript Not Loaded'),
(8192 , 'JavaScript Check Failed'),
(16384 , 'Identifier Validation Error'),
(32768 , 'Known Violator Automation Tool'),
(65536 , 'Form Spam Submission'),
(131072 , 'Unverified Signature'),
(262144 , 'IP Pinning Failure'),
(524288 , 'Invalid JavaScript Test Results'),
(1048576 , 'Organization Block'),
(2097152 , 'Known Violator Data Center'),
(4194304 , 'ACL User Agent'),
(8388608 , 'ACL ID'),
(16777216 , 'ACL Header'),
(134217728 , 'ACL Extension'),
(268435456 , 'Missing Unique ID'),
(536870912 , 'Requests Per Minute')
]
def help():
print("threat_extract.py threat_number")
if __name__ == '__main__':
if len(sys.argv) != 2:
help()
exit()
threat_number = int(sys.argv[1])
print(','.join([v for k, v in hsh if k & threat_number]))
... View more