mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-27 00:07:16 +00:00
Starting support of python3
This commit is contained in:
parent
ee7759be91
commit
6f0227a78a
3 changed files with 18 additions and 20 deletions
|
@ -33,21 +33,9 @@ if __name__ == "__main__":
|
||||||
from pymisp import PyMISP
|
from pymisp import PyMISP
|
||||||
|
|
||||||
pymisp = PyMISP(misp_url, misp_key, misp_verifycert)
|
pymisp = PyMISP(misp_url, misp_key, misp_verifycert)
|
||||||
eventID = "9356"
|
|
||||||
mispTYPE = 'ail-leak'
|
|
||||||
|
|
||||||
moduleName = "Credentials"
|
moduleName = "Credentials"
|
||||||
path = "/home/sami/git/AIL-framework/PASTES/archive/pastebin.com_pro/2017/08/23/bPFaJymf.gz"
|
path = "/home/sami/git/AIL-framework/PASTES/archive/pastebin.com_pro/2017/08/23/bPFaJymf.gz"
|
||||||
|
|
||||||
misp_object = AilleakObject(moduleName, path)
|
wrapper = objectWrapper(moduleName, path, pymisp)
|
||||||
print('validate mispobj', misp_object._validate())
|
wrapper.pushToMISP()
|
||||||
print(misp_object)
|
|
||||||
|
|
||||||
# Publish object to MISP
|
|
||||||
try:
|
|
||||||
templateID = [x['ObjectTemplate']['id'] for x in pymisp.get_object_templates_list() if x['ObjectTemplate']['name'] == mispTYPE][0]
|
|
||||||
except IndexError:
|
|
||||||
valid_types = ", ".join([x['ObjectTemplate']['name'] for x in pymisp.get_object_templates_list()])
|
|
||||||
print ("Template for type %s not found! Valid types are: %s" % (mispTYPE, valid_types))
|
|
||||||
print(templateID)
|
|
||||||
#r = pymisp.add_object(eventID, templateID, misp_object)
|
|
||||||
|
|
|
@ -32,10 +32,10 @@ class Date(object):
|
||||||
self.day = day
|
self.day = day
|
||||||
|
|
||||||
def substract_day(self, numDay):
|
def substract_day(self, numDay):
|
||||||
import datetime
|
import datetime
|
||||||
computed_date = datetime.date(int(self.year), int(self.month), int(self.day)) - datetime.timedelta(numDay)
|
computed_date = datetime.date(int(self.year), int(self.month), int(self.day)) - datetime.timedelta(numDay)
|
||||||
comp_year = str(computed_date.year)
|
comp_year = str(computed_date.year)
|
||||||
comp_month = str(computed_date.month).zfill(2)
|
comp_month = str(computed_date.month).zfill(2)
|
||||||
comp_day = str(computed_date.day).zfill(2)
|
comp_day = str(computed_date.day).zfill(2)
|
||||||
return comp_year + comp_month + comp_day
|
return comp_year + comp_month + comp_day
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,17 @@ import operator
|
||||||
import string
|
import string
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
import ConfigParser
|
try: # dirty to support python3
|
||||||
import cStringIO
|
import ConfigParser
|
||||||
|
except:
|
||||||
|
import configparser
|
||||||
|
ConfigParser = configparser
|
||||||
|
try: # dirty to support python3
|
||||||
|
import cStringIO
|
||||||
|
except:
|
||||||
|
from io import StringIO as cStringIO
|
||||||
|
import sys
|
||||||
|
sys.path.append(os.path.join(os.environ['AIL_BIN'], 'packages/'))
|
||||||
from Date import Date
|
from Date import Date
|
||||||
from Hash import Hash
|
from Hash import Hash
|
||||||
|
|
||||||
|
@ -84,6 +93,7 @@ class Paste(object):
|
||||||
var = self.p_path.split('/')
|
var = self.p_path.split('/')
|
||||||
self.p_date = Date(var[-4], var[-3], var[-2])
|
self.p_date = Date(var[-4], var[-3], var[-2])
|
||||||
self.p_source = var[-5]
|
self.p_source = var[-5]
|
||||||
|
self.supposed_url = 'https://{}/{}'.format(self.p_source.replace('_pro', ''), var[-1].split('.gz')[0])
|
||||||
|
|
||||||
self.p_encoding = None
|
self.p_encoding = None
|
||||||
self.p_hash_kind = {}
|
self.p_hash_kind = {}
|
||||||
|
|
Loading…
Reference in a new issue