mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-23 06:37:15 +00:00
Merge pull request #48 from MaximeStor/module
Add modules Credential and Release
This commit is contained in:
commit
fe08d2f9cd
3 changed files with 106 additions and 0 deletions
47
bin/Credential.py
Executable file
47
bin/Credential.py
Executable file
|
@ -0,0 +1,47 @@
|
||||||
|
#!/usr/bin/env python2
|
||||||
|
# -*-coding:UTF-8 -*
|
||||||
|
import time
|
||||||
|
from packages import Paste
|
||||||
|
from pubsublogger import publisher
|
||||||
|
from Helper import Process
|
||||||
|
import re
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
publisher.port = 6380
|
||||||
|
publisher.channel = "Script"
|
||||||
|
config_section = "Credential"
|
||||||
|
p = Process(config_section)
|
||||||
|
publisher.info("Find credentials")
|
||||||
|
|
||||||
|
critical = 10
|
||||||
|
|
||||||
|
regex_web = "/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/"
|
||||||
|
regex_cred = "[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}:[a-zA-Z0-9\_\-]+"
|
||||||
|
while True:
|
||||||
|
message = p.get_from_set()
|
||||||
|
if message is not None:
|
||||||
|
paste = Paste.Paste(message)
|
||||||
|
content = paste.get_p_content()
|
||||||
|
all_cred = re.findall(regex_cred, content)
|
||||||
|
if len(all_cred) > 0:
|
||||||
|
cred_set = set([])
|
||||||
|
for cred in all_cred:
|
||||||
|
cred_set.add(cred)
|
||||||
|
|
||||||
|
to_print = 'Cred;{};{};{};'.format(paste.p_source, paste.p_date, paste.p_name)
|
||||||
|
if len(cred_set) > 0:
|
||||||
|
publisher.info(to_print)
|
||||||
|
for cred in set(cred_set):
|
||||||
|
print(cred)
|
||||||
|
|
||||||
|
if len(cred_set) > critical:
|
||||||
|
print("========> Found more than 10 credentials on this file : {}".format(message))
|
||||||
|
site = re.findall(regex_web, content)
|
||||||
|
publisher.warning(to_print)
|
||||||
|
if len(site) > 0:
|
||||||
|
print("=======> Probably on : {}".format(iter(site).next()))
|
||||||
|
|
||||||
|
else:
|
||||||
|
publisher.debug("Script Credential is Idling 10s")
|
||||||
|
print 'Sleeping'
|
||||||
|
time.sleep(10)
|
53
bin/Release.py
Executable file
53
bin/Release.py
Executable file
|
@ -0,0 +1,53 @@
|
||||||
|
#!/usr/bin/env python2
|
||||||
|
# -*-coding:UTF-8 -*
|
||||||
|
import time
|
||||||
|
from packages import Paste
|
||||||
|
from pubsublogger import publisher
|
||||||
|
from Helper import Process
|
||||||
|
import re
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
publisher.port = 6380
|
||||||
|
publisher.channel = "Script"
|
||||||
|
config_section = "Release"
|
||||||
|
p = Process(config_section)
|
||||||
|
publisher.info("Release scripts to find release names")
|
||||||
|
|
||||||
|
#REGEX :
|
||||||
|
|
||||||
|
movie = "[a-zA-Z0-9.]+\.[0-9]{4}.[a-zA-Z0-9.]+\-[a-zA-Z]+"
|
||||||
|
tv = "[a-zA-Z0-9.]+\.S[0-9]{2}E[0-9]{2}.[a-zA-Z0-9.]+\.[a-zA-Z0-9.]+\-[a-zA-Z0-9]+"
|
||||||
|
xxx = "[a-zA-Z0-9._]+.XXX.[a-zA-Z0-9.]+\-[a-zA-Z0-9]+"
|
||||||
|
|
||||||
|
regexs = [movie,tv,xxx]
|
||||||
|
|
||||||
|
regex = re.compile('|'.join(regexs))
|
||||||
|
while True:
|
||||||
|
message = p.get_from_set()
|
||||||
|
if message is not None:
|
||||||
|
paste = Paste.Paste(message)
|
||||||
|
content = paste.get_p_content()
|
||||||
|
all_release = re.findall(regex, content)
|
||||||
|
if len(all_release) > 0:
|
||||||
|
release_set = set([])
|
||||||
|
for rlz in all_release:
|
||||||
|
release_set.add(rlz)
|
||||||
|
|
||||||
|
to_print = 'Release;{};{};{};'.format(paste.p_source, paste.p_date, paste.p_name)
|
||||||
|
if (len(release_set) > 0):
|
||||||
|
publisher.warning('{}Checked {} valids'.format(to_print, len(release_set)))
|
||||||
|
for rl in set(release_set):
|
||||||
|
#publisher.warning('{}'.format(rl))
|
||||||
|
print(rl)
|
||||||
|
if (len(release_set) > 10):
|
||||||
|
print("----------------------------------- Found more than 10 releases on this file : {}".format(message))
|
||||||
|
|
||||||
|
else:
|
||||||
|
publisher.info('{}Release related'.format(to_print))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
else:
|
||||||
|
publisher.debug("Script Release is Idling 10s")
|
||||||
|
print 'Sleeping'
|
||||||
|
time.sleep(10)
|
|
@ -47,6 +47,12 @@ subscribe = Redis_ValidOnion
|
||||||
subscribe = Redis_Web
|
subscribe = Redis_Web
|
||||||
publish = Redis_Url,ZMQ_Url
|
publish = Redis_Url,ZMQ_Url
|
||||||
|
|
||||||
|
[Release]
|
||||||
|
subscribe = Redis_Global
|
||||||
|
|
||||||
|
[Credential]
|
||||||
|
subscribe = Redis_Global
|
||||||
|
|
||||||
[Keys]
|
[Keys]
|
||||||
subscribe = Redis_Global
|
subscribe = Redis_Global
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue