def PyFile(shellcode): import time db = """#!/usr/bin/python import ctypes import multiprocessing #Project : https://github.com/b3mb4m/Shellsploit #This file created with shellsploit .. #%s - %s shellcode_data = (b"%s") shellcode = ctypes.c_char_p(shellcode_data) function = ctypes.cast(shellcode, ctypes.CFUNCTYPE(None)) addr = ctypes.cast(function, ctypes.c_void_p).value libc = ctypes.CDLL('libc.so.6') pagesize = libc.getpagesize() addr_page = (addr // pagesize) * pagesize for page_start in range(addr_page, addr + len(shellcode_data), pagesize): assert libc.mprotect(page_start, pagesize, 0x7) == 0 function() """ % (time.strftime("%d/%m/%Y"), time.strftime("%H:%M:%S"), shellcode) from logger import logs logs(db, "py")
def PyFile( shellcode): import time db = """#!/usr/bin/python import ctypes import multiprocessing #Project : https://github.com/b3mb4m/Shellsploit #This file created with shellsploit .. #%s - %s shellcode_data = (b"%s") shellcode = ctypes.c_char_p(shellcode_data) function = ctypes.cast(shellcode, ctypes.CFUNCTYPE(None)) addr = ctypes.cast(function, ctypes.c_void_p).value libc = ctypes.CDLL('libc.so.6') pagesize = libc.getpagesize() addr_page = (addr // pagesize) * pagesize for page_start in range(addr_page, addr + len(shellcode_data), pagesize): assert libc.mprotect(page_start, pagesize, 0x7) == 0 function() """ % (time.strftime("%d/%m/%Y"), time.strftime("%H:%M:%S"), shellcode) from logger import logs logs( db, "py")
def setUp(self): try: # app包名 d = self.driver() d.app_start(package_name) d.implicitly_wait(5.0) except Exception as e: logger.logs("启动app失败:" + str(e))
def setUp(self): try: # app包名 d = self.driver() d.app_start(package_name) time.sleep(3) except Exception as e: logger.logs("启动app失败:" + str(e))
def CplusplusFile( shellcode, win=False): import time if win == True: db = """//Project : https://github.com/b3mb4m/Shellsploit //This file created with shellsploit .. //%s - %s //Compile : gcc shell.c -o shell.exe #include <stdlib.h> #include <stdio.h> #include <string.h> #include <windows.h> int main(void) { char *shellcode = "%s"; DWORD why_must_this_variable; BOOL ret = VirtualProtect (shellcode, strlen(shellcode), PAGE_EXECUTE_READWRITE, &why_must_this_variable); if (!ret) { printf ("VirtualProtect"); return EXIT_FAILURE; } ((void (*)(void))shellcode)(); return EXIT_SUCCESS; } """ % (time.strftime("%d/%m/%Y"), time.strftime("%H:%M:%S"), shellcode) else: db = """//Project : https://github.com/b3mb4m/Shellsploit //This file created with shellsploit .. //%s - %s //Compile : g++ -fno-stack-protector -z execstack shell.cpp -o shell unsigned char shellcode[] = "%s"; int main(){ int (*func)() = (int(*)())shellcode; func(); } """ % (time.strftime("%d/%m/%Y"), time.strftime("%H:%M:%S"), shellcode) from logger import logs logs( db, "cpp")
def CplusplusFile(shellcode, win=False): import time if win == True: db = """//Project : https://github.com/b3mb4m/Shellsploit //This file created with shellsploit .. //%s - %s //Compile : gcc shell.c -o shell.exe #include <stdlib.h> #include <stdio.h> #include <string.h> #include <windows.h> int main(void) { char *shellcode = "%s"; DWORD why_must_this_variable; BOOL ret = VirtualProtect (shellcode, strlen(shellcode), PAGE_EXECUTE_READWRITE, &why_must_this_variable); if (!ret) { printf ("VirtualProtect"); return EXIT_FAILURE; } ((void (*)(void))shellcode)(); return EXIT_SUCCESS; } """ % (time.strftime("%d/%m/%Y"), time.strftime("%H:%M:%S"), shellcode) else: db = """//Project : https://github.com/b3mb4m/Shellsploit //This file created with shellsploit .. //%s - %s //Compile : g++ -fno-stack-protector -z execstack shell.cpp -o shell unsigned char shellcode[] = "%s"; int main(){ int (*func)() = (int(*)())shellcode; func(); } """ % (time.strftime("%d/%m/%Y"), time.strftime("%H:%M:%S"), shellcode) from logger import logs logs(db, "cpp")
def gaussian_blur(img, intensity): ''' Apply a blur filter to an image. :param img: image src (image to apply the filter) :param intensity: a value to define the intensity of the filter (higher value = more blur) :return: edited ''' try: edited = cv2.GaussianBlur(img, (intensity, intensity), 0) lg.logs(f'Blur filter applied to picture') return edited except cv2.error: print('Please select an impair value')
def TxtFile( shellcode): import time db = """#Project : https://github.com/b3mb4m/Shellsploit #This file created with shellsploit .. #%s - %s %s """ % (time.strftime("%d/%m/%Y"), time.strftime("%H:%M:%S"), shellcode) from logger import logs logs( db, "txt")
def dilate(img, intensity): ''' Apply a dilatation filter to an image. :param img: image src (image to apply the filter) :param intensity: a value to define the intensity of the filter (higher value = more dilatation) :return: edited ''' try: kernel = numpy.ones((intensity, intensity), numpy.uint8) edited = cv2.dilate(img,kernel,iterations=5) lg.logs(f'Dilate filter applied to picture') return edited except cv2.error: print('Error')
def ExeFile( shellcode, OS=None): if OS == None: OS = detectOS() from logger import logs from Database.exedb import ros from raw import RawFile db = ros() padd = "" if OS == "linux86": padd = db[0] elif OS == "linux64": padd = db[1] elif OS == "windows": padd = db[2] elif OS == "openbsdx86": padd = db[3] elif OS == "solarisx86": padd = db[4] elif OS == "linuxpowerpc": padd = db[5] elif OS == "openbsdpowerpc": padd = db[6] elif OS == "linuxsparc": padd = db[7] elif OS == "freebsdsparc": padd = db[8] elif OS == "opensbdsparc": padd = db[9] elif OS == "solarissparc": padd = db[10] elif OS == "linuxarm": padd = db[11] elif OS == "freebsdarm": padd = db[12] elif OS == "opensbdarm": padd = db[13] else: print "Not supported os .." return shellcode = shellcode.replace("\\x", "") shellcode = padd.replace("SHELLCODE", shellcode) logs( shellcode.decode("hex"), None)
def out_land(account_ID): ac_data = accounts_data.account_data(account_ID)[0] ac_data['land_status'] = 0 # 退出时将登录状态置0 save_file(ac_data, account_ID) out_log = '%s 退出!' % (account_ID) # 记录退出登录日志 trans_logger = logger.logs('landing') trans_logger.info(out_log)
def CFile( shellcode): import time db = """//Project : https://github.com/b3mb4m/Shellsploit //This file created with shellsploit .. //%s - %s //Compile : gcc -fno-stack-protector -z execstack shell.c -o shell unsigned char shellcode[] = "%s"; int main(void){ (*(void(*)()) shellcode)(); } """ % (time.strftime("%d/%m/%Y"), time.strftime("%H:%M:%S"), shellcode) from logger import logs logs( db, "c")
def CFile(shellcode): import time db = """//Project : https://github.com/b3mb4m/Shellsploit //This file created with shellsploit .. //%s - %s //Compile : gcc -fno-stack-protector -z execstack shell.c -o shell unsigned char shellcode[] = "%s"; int main(void){ (*(void(*)()) shellcode)(); } """ % (time.strftime("%d/%m/%Y"), time.strftime("%H:%M:%S"), shellcode) from logger import logs logs(db, "c")
def ze_team(img): ''' Apply our filter to an image. :param img: image src (image to apply the filter) :return: edited ''' try: font = cv2.FONT_HERSHEY_SIMPLEX bottomLeftCornerOfText = (100, 350) fontScale = 2 fontColor = (255, 255, 255) lineType = 3 cv2.waitKey(0) edited = cv2.putText(img, f'Leonard Allan Mael',bottomLeftCornerOfText,font,fontScale,fontColor,lineType) lg.logs(f' ZeTeam filter applied to picture') return edited except cv2.error: print('Error')
def frozen_account(account_ID): ac_data = accounts_data.account_data(account_ID)[0] ac_data['user_locks'] = 1 # 将用户冻结状态修改为1 ac_data['land_status'] = 0 # 冻结后将用户在线状态修改为0 lock_time = datetime.datetime.now() # 获取用户冻结时间 lock_log = '%s %s被冻结' % (lock_time, account_ID) # 记录冻结日志 landing.save_file(ac_data, account_ID) trans_logger = logger.logs('landing') trans_logger.info(lock_log) print('冻结成功!')
def message(img, input_txt): ''' Add a message to display on a picture. :param img: image src (image to apply the filter) :param input_txt: a str to define the texte of the filter :return: edited ''' try: font = cv2.FONT_HERSHEY_SIMPLEX bottomLeftCornerOfText = (100, 350) fontScale = 2 fontColor = (255, 255, 255) lineType = 3 cv2 .waitKey(0) edited = cv2.putText(img, f'{input_txt}',bottomLeftCornerOfText,font,fontScale,fontColor,lineType) lg.logs(f'Message filter applied to picture') return edited except cv2.error: print('Error')
def test_run(self): ''' :return: ''' try: d = self.driver() logger.logs(u"app启动") window_size = d.window_size() point_x = window_size[0] point_y = window_size[1] global count while count > 0: x_random = random.randint(0, point_x) y_random = random.randint(0, point_y) print("点击坐标X:{},Y:{}".format(x_random, y_random)) d.click(x_random, y_random) time.sleep(event_wait) count -= 1 except Exception as e: logger.logs("测试用例执行异常:" + str(e))
def account_inner(account_ID): count = 0 ac_data = accounts_data.account_data(account_ID)[0] # 读取用户数据 while count < 3: if ac_data['user_locks'] == 0: # 判断用户是否被冻结,0表示未冻结,1表示冻结 if ac_data['land_status'] == 0: # 判断用户认证状态,0代表未认证,1代表已认证 account_password = input('请输入密码:').strip() if account_password == ac_data['password']: ac_data['land_status'] = 1 # 登录成功将认证状态改为1 save_file(ac_data, account_ID) # 将用户数据写入文件 land_log = '%s 认证成功!' % (account_ID) # 保存登录日志 trans_logger = logger.logs('landing') trans_logger.info(land_log) print('登录成功,欢迎.....') else: count += 1 print('密码错误,请重新输入!') else: print('登录验证通过...') break else: ac_data['user_locks'] = 1 # 将用户冻结状态修改为1 save_file(ac_data, account_ID) # 保存用户修改后数据 print('用户已被冻结,请前往柜台解冻!') break if count == 3: # 密码输入错误超过三次,账号冻结 ac_data['user_locks'] = 1 save_file(ac_data, account_ID) frozed_log = '%s 密码输入次数过多,账户被冻结!' \ % (account_ID) # 记录账户被冻结日志 trans_logger = logger.logs('landing') trans_logger.info(frozed_log) print('密码输入次数过多,账号被冻结!') if ac_data['land_status'] == 1: func(account_ID)
def disp_filters(): ''' Search in an array of each filters, remove the .py then display it. ''' logger.logs('Display filters list') print('----------') for i in files: image = i if image == 'blur.py': description = 'Apply an blur effect on pictures (works with int to configure the intensity of the filter)' print(f'{image.replace(".py", "")}' + ' >> ' + f'{description}') elif image == 'dilate_effect.py': description = "Apply an dilatation effect on pictures (works with int to configure the intensity of the filter)" print(f'{image.replace(".py", "")}' + ' >> ' + f'{description}') elif image == 'grayscale.py': description = 'Apply a black and white effect on pictures' print(f'{image.replace(".py", "")}' + ' >> ' + f'{description}') elif image == 'message.py': description = 'Enter a message to display on pictures (works with a string to configure the message)' print(f'{image.replace(".py", "")}' + ' >> ' + f'{description}') elif image == 'zeteam.py': description = 'Apply our team effect on pictures (Display our names on the pictures)' print(f'{image.replace(".py", "")}' + ' >> ' + f'{description}') print('----------')
def change_credit(account_ID): ac_data = accounts_data.account_data(account_ID)[0] old_credit = ac_data['total'] print('当前信用额度:', ac_data['total']) flag = True while flag: c_credit = input('请输入调整后的额度:').strip() if c_credit.isdigit(): c_credit = float(c_credit) ac_data['total'] = c_credit c_credit_log = '%s 信用额度从%s修改为%s'\ %(account_ID,old_credit,c_credit) # 记录日志 landing.save_file(ac_data, account_ID) # 保存修改后数据 trans_logger = logger.logs('tansaction') trans_logger.info(c_credit_log) print('额度修改成功!') elif c_credit == 'b': flag = False else: print('请输入正确的金额!')
def testcase(self): try: d = self.driver() logger.logs(u"app启动") # # 判断登录状态 # if d(text=u"随便看看").info['text']: # d(text=u"随便看看").click() # 点击听书 d(text=u"听书").click() logger.logs(u"点击听书") # 获取主编力荐的列表页的文案 get_text = d(resourceId="com.luojilab.player:id/tv_product_name" ).info['text'] logger.logs(get_text) # 点击主编力荐 d(resourceId="com.luojilab.player:id/tv_product_name").click() # 点击分享 d(resourceId="com.luojilab.player:id/shareButton").click() d(text=u"微信").click() # 点击分享给share_name d(text=share_name, className="android.widget.TextView").click() # 点击微信中分享按钮 d(text=u"分享", className="android.widget.Button").click() # 点击留在微信 d(text=u"留在微信").click() # 点击微信列表中share_name d(text=share_name, className="android.view.View").click() # 点击微信会话中的分享h5链接 d(text=get_text, className="android.widget.TextView").click() # 获取h5页面中title的文案 title = d(resourceId="android:id/text1").info['text'] logger.logs("获取title:" + str(title)) # 判断title和之前获取的文案是否相同 if get_text in title: self.assertTrue(True) logger.logs("微信h5页面验证分享成功") else: self.assertFalse(True) logger.logs("微信h5页面验证分享失败") except Exception as e: logger.logs("测试用例执行异常:" + str(e))
def tearDown(self): try: d = self.driver() d.app_stop(package_name) except Exception as e: logger.logs("关闭app异常:" + str(e))
def ExeFile( shellcode, OS=None): if OS == None: OS = detectOS() from logger import logs from Database.exedb import B3m #0 linux86 #1 linux64 #2 windows x86/x64 #3 openbsdx86 #4 solarisx86 #5 linuxpowerpc #6 openbsdpowerpc #7 linuxsparc #8 freebsdsparc #9 opensbdsparc #10 solarissparc #11 linuxarm #12 freebsdarm #13 opensbdarm #64 bits will be add soon .. db = B3m() padd = "" if OS == "linux86": padd = db[0] elif OS == "linux64": padd = db[1] elif OS == "windows": padd = db[2] elif OS == "openbsdx86": padd = db[3] elif OS == "solarisx86": padd = db[4] elif OS == "linuxpowerpc": padd = db[5] elif OS == "openbsdpowerpc": padd = db[6] elif OS == "linuxsparc": padd = db[7] elif OS == "freebsdsparc": padd = db[8] elif OS == "opensbdsparc": padd = db[9] elif OS == "solarissparc": padd = db[10] elif OS == "linuxarm": padd = db[11] elif OS == "freebsdarm": padd = db[12] elif OS == "opensbdarm": padd = db[13] else: print "Not supported os .." return shellcode = shellcode.replace("\\x", "") shellcode = padd.replace("SHELLCODE", shellcode) logs( shellcode.decode("hex"), None)
def RawFile( shellcode): sc = unhexlify(shellcode.replace("\\x", "")) logs( sc, None)
#!/usr/bin/env python3 import os from logger import logs l=logs(os.path.basename(__file__)) l.write_log("info", "test message") l.write_log("warn", "WARNING") l.write_log("error", "This is an ERROR") l.write_log("critical", "THIS IS CRITICAL")
def help(): ''' Display every arguments of the program ''' print('usage : imagefilter\n -h >> Display informations about the function\n -i [folder] >> Enter a folder in pair with this argument to add it as image "image picker"\n -o [folder] >> Enter a folder in pair with this argument to add it as output folder (for saving images)\n --list-filters >> Display all available filters to apply\n --filters [filters] >> Enter filters in pair with this argument to select wanted effect to apply\n Example: --filter "blur:3|dilate:5|grayscale"') logger.logs('Display help page')