def grabPortBanner(request): # Init of the view grabPortBanner try: # Pool call response, repool = sendPool(request, 'grabPortBanner') if response or repool: if repool: return HttpResponse(response) return JsonResponse({"data": str(response)}) else: # Parameter ip ip = request.POST.get('ip') # Parameter port port = request.POST.get('port') # Execute, get result and show it result = ht.getModule('ht_bannergrabber').grabPortBanner(ip=ip, port=port) if request.POST.get('is_async_grabPortBanner', False): return JsonResponse({"data": result}) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_grabPortBanner', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e))
def getImports(request): # Init of the view getImports try: # Pool call response, repool = sendPool(request, 'getImports') if response or repool: if repool: return HttpResponse(response) return JsonResponse({"data": str(response)}) else: try: # Save file filemon filename_filemon, location_filemon, filemon = saveFileOutput( request.FILES['filemon'], 'radare2', 'reversing') except Exception as e: # If not param filemon if request.POST.get('is_async_getImports', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e)) # Execute, get result and show it result = ht.getModule('ht_radare2').getImports(filemon=filemon) if request.POST.get('is_async_getImports', False): return JsonResponse({"data": returnAsModal(result)}) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_getImports', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e))
def encodeFromComplexMap(request): # Init of the view encodeFromComplexMap try: # Pool call response, repool = sendPool(request, 'encodeFromComplexMap') if response or repool: if repool: return HttpResponse(response) return JsonResponse({ "data" : str(response) }) else: # Parameter password password = request.POST.get('password') # Parameter plaintext plaintext = request.POST.get('plaintext') # Execute, get result and show it result = ht.getModule('ht_rsa').encodeFromComplexMap( password=password, plaintext=plaintext ) if request.POST.get('is_async_encodeFromComplexMap', False): return JsonResponse({ "data" : result }) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_encodeFromComplexMap', False): return JsonResponse({ "data" : str(e) }) return renderMainPanel(request=request, popup_text=str(e))
def decodeFromComplexMap(request): # Init of the view decodeFromComplexMap try: # Pool call response, repool = sendPool(request, 'decodeFromComplexMap') if response or repool: if repool: return HttpResponse(response) return JsonResponse({"data": str(response)}) else: # Parameter password password = request.POST.get('password') # Parameter ciphertext ciphertext = request.POST.get('ciphertext') # Parameter complexMap complexMap = request.POST.get('complexMap') # Execute, get result and show it result = ht.getModule('ht_rsa').decodeFromComplexMap( password=password, ciphertext=ciphertext, complexMap=complexMap) if request.POST.get('is_async_decodeFromComplexMap', False): return JsonResponse({"data": returnAsModal(result)}) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_decodeFromComplexMap', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e))
def upload_files(request): # Init of the view upload_files try: # Pool call response, repool = sendPool(request, 'upload_files') if response or repool: if repool: return HttpResponse(response) return JsonResponse({"data": str(response)}) else: try: # Save file files filename_files, location_files, files = saveFileOutput( request.FILES['files'], 'ssh', 'connector') except Exception as e: # If not param files if request.POST.get('is_async_upload_files', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e)) # Execute the function ht.getModule('ht_ssh').upload_files(files=files) except Exception as e: if request.POST.get('is_async_upload_files', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e))
def encrypt(request): # Init of the view encrypt try: # Pool call response, repool = sendPool(request, 'encrypt') if response or repool: if repool: return HttpResponse(response) return JsonResponse({ "data" : str(response) }) else: # Parameter password password = request.POST.get('password') # Parameter text text = request.POST.get('text') # Execute, get result and show it result = ht.getModule('ht_rc4').encrypt( password=password, text=text ) if request.POST.get('is_async_encrypt', False): return JsonResponse({ "data" : returnAsModal(result) }) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_encrypt', False): return JsonResponse({ "data" : str(e) }) return renderMainPanel(request=request, popup_text=str(e))
def isBadFileHash(request): # Init of the view isBadFileHash try: # Pool call response, repool = sendPool(request, 'isBadFileHash') if response or repool: if repool: return HttpResponse(response) return JsonResponse({"data": str(response)}) else: try: # Save file fileHash filename_fileHash, location_fileHash, fileHash = saveFileOutput( request.FILES['fileHash'], 'virustotal', 'forensic') except Exception as e: # If not param fileHash if request.POST.get('is_async_isBadFileHash', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e)) # Execute, get result and show it result = ht.getModule('ht_virustotal').isBadFileHash( fileHash=fileHash) if request.POST.get('is_async_isBadFileHash', False): return JsonResponse({"data": returnAsModal(result)}) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_isBadFileHash', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e))
def extractFile(request): # Init of the view extractFile try: # Pool call response, repool = sendPool(request, 'extractFile') if response or repool: if repool: return HttpResponse(response) return JsonResponse({"data": str(response)}) else: try: # Save file zipPathName filename_zipPathName, location_zipPathName, zipPathName = saveFileOutput( request.FILES['zipPathName'], 'unzip', 'crackers') except Exception as e: # If not param zipPathName if request.POST.get('is_async_extractFile', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e)) # Parameter password (Optional - Default None) password = request.POST.get('password', None) if not password: password = None # Execute, get result and show it result = ht.getModule('ht_unzip').extractFile( zipPathName=zipPathName, password=password) if request.POST.get('is_async_extractFile', False): return JsonResponse({"data": returnAsModal(result)}) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_extractFile', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e))
def get_mp3_exif(request): # Init of the view get_mp3_exif try: # Pool call response, repool = sendPool(request, 'get_mp3_exif') if response or repool: if repool: return HttpResponse(response) return JsonResponse({"data": str(response)}) else: try: # Save file mp3_file filename_mp3_file, location_mp3_file, mp3_file = saveFileOutput( request.FILES['mp3_file'], 'metadata', 'forensic') except Exception as e: # If not param mp3_file if request.POST.get('is_async_get_mp3_exif', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e)) # Execute, get result and show it result = ht.getModule('ht_metadata').get_mp3_exif( mp3_file=mp3_file) if request.POST.get('is_async_get_mp3_exif', False): return JsonResponse({"data": returnAsModal(result)}) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_get_mp3_exif', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e))
def encrypt(request): # Init of the view encrypt try: # Pool call response, repool = sendPool(request, 'encrypt') if response or repool: if repool: return HttpResponse(response) return JsonResponse({ "data" : str(response) }) else: # Parameter private_key private_key = tuple(request.POST.get('private_key')) # Parameter plaintext plaintext = request.POST.get('plaintext') # Execute, get result and show it result = ht.getModule('ht_rsa').encrypt( private_key=private_key, plaintext=plaintext ) if request.POST.get('is_async_encrypt', False): return JsonResponse({ "data" : str(result) }) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_encrypt', False): return JsonResponse({ "data" : str(e) }) return renderMainPanel(request=request, popup_text=str(e))
def getSSLCerts(request): # Init of the view getSSLCerts try: # Pool call response, repool = sendPool(request, 'getSSLCerts') if response or repool: if repool: return HttpResponse(response) return JsonResponse({ "data" : str(response) }) else: # Parameter ip ip = request.POST.get('ip') # Parameter shodan_api (Optional - Default None) shodan_api = request.POST.get('shodan_api', None) if not shodan_api: shodan_api = None # Execute, get result and show it result = ht.getModule('ht_shodan').getSSLCerts( ip=ip, shodan_api=shodan_api ) if request.POST.get('is_async_getSSLCerts', False): return JsonResponse({ "data" : returnAsModal(result) }) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_getSSLCerts', False): return JsonResponse({ "data" : str(e) }) return renderMainPanel(request=request, popup_text=str(e))
def generate_keypair(request): # Init of the view generate_keypair try: # Pool call response, repool = sendPool(request, 'generate_keypair') if response or repool: if repool: return HttpResponse(response) return JsonResponse({ "data" : str(response) }) else: # Parameter prime_a prime_a = request.POST.get('prime_a') # Parameter prime_b prime_b = request.POST.get('prime_b') # Execute, get result and show it result1, result2 = ht.getModule('ht_rsa').generate_keypair( prime_a=int(prime_a), prime_b=int(prime_b) ) if request.POST.get('is_async_generate_keypair', False): return JsonResponse({ "data" : '({n1},{n2})'.format(n1=result1, n2=result2) }) return renderMainPanel(request=request, popup_text='({n1},{n2})'.format(n1=result1, n2=result2)) except Exception as e: if request.POST.get('is_async_generate_keypair', False): return JsonResponse({ "data" : str(e) }) return renderMainPanel(request=request, popup_text=str(e))
def queryShodan(request): # Init of the view queryShodan try: # Pool call response, repool = sendPool(request, 'queryShodan') if response or repool: if repool: return HttpResponse(response) return JsonResponse({ "data" : str(response) }) else: # Parameter category (Optional - Default ) category = request.POST.get('category', '') if not category: category = None # Parameter osintDays (Optional - Default 100) osintDays = request.POST.get('osintDays', 100) # Parameter shodan_api (Optional - Default None) shodan_api = request.POST.get('shodan_api', None) if not shodan_api: shodan_api = None # Execute, get result and show it result = ht.getModule('ht_shodan').queryShodan( category=category, osintDays=osintDays, shodan_api=shodan_api ) if request.POST.get('is_async_queryShodan', False): return JsonResponse({ "data" : returnAsModal(result) }) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_queryShodan', False): return JsonResponse({ "data" : str(e) }) return renderMainPanel(request=request, popup_text=str(e))
def searchFromConfig(request): # Init of the view searchFromConfig try: # Pool call response, repool = sendPool(request, 'searchFromConfig') if response or repool: if repool: return HttpResponse(response) return JsonResponse({ "data" : str(response) }) else: # Parameter search (Optional - Default ) search = request.POST.get('search', '') if not search: search = None # Parameter keyword (Optional - Default ) keyword = request.POST.get('keyword', '') if not keyword: keyword = None # Parameter shodan_api (Optional - Default None) shodan_api = request.POST.get('shodan_api', None) if not shodan_api: shodan_api = None # Execute, get result and show it result = ht.getModule('ht_shodan').searchFromConfig( search=search, keyword=keyword, shodan_api=shodan_api ) if request.POST.get('is_async_searchFromConfig', False): return JsonResponse({ "data" : returnAsModal(result) }) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_searchFromConfig', False): return JsonResponse({ "data" : str(e) }) return renderMainPanel(request=request, popup_text=str(e))
def getDevicePorts(request): # Init of the view getDevicePorts try: # Pool call response, repool = sendPool(request, 'getDevicePorts') if response or repool: if repool: return HttpResponse(response) return JsonResponse({ "data" : str(response) }) else: # Parameter ip ip = request.POST.get('ip') # Parameter tcp (Optional - Default True) tcp = request.POST.get('tcp', True) # Parameter udp (Optional - Default False) udp = request.POST.get('udp', False) if not udp: udp = None # Execute, get result and show it result = ht.getModule('ht_nmap').getDevicePorts( ip=ip, tcp=tcp, udp=udp ) if request.POST.get('is_async_getDevicePorts', False): return JsonResponse({ "data" : returnAsModal(result) }) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_getDevicePorts', False): return JsonResponse({ "data" : str(e) }) return renderMainPanel(request=request, popup_text=str(e))
def getIPListfromServices(request): # Init of the view getIPListfromServices try: # Pool call response, repool = sendPool(request, 'getIPListfromServices') if response or repool: if repool: return HttpResponse(response) return JsonResponse({ "data" : str(response) }) else: # Parameter serviceName serviceName = request.POST.get('serviceName') # Parameter shodan_api (Optional - Default None) shodan_api = request.POST.get('shodan_api', None) if not shodan_api: shodan_api = None fromMap = request.POST.get('fromMap', None) if not fromMap: fromMap = None # Execute, get result and show it result = ht.getModule('ht_shodan').getIPListfromServices( serviceName=serviceName, shodan_api=shodan_api ) if request.POST.get('is_async_getIPListfromServices', False): if fromMap: return JsonResponse({ "data" : result }) return JsonResponse({ "data" : returnAsModal(result) }) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_getIPListfromServices', False): return JsonResponse({ "data" : str(e) }) return renderMainPanel(request=request, popup_text=str(e))
def hasDevicePortOpened(request): # Init of the view hasDevicePortOpened try: # Pool call response, repool = sendPool(request, 'hasDevicePortOpened') if response or repool: if repool: return HttpResponse(response) return JsonResponse({ "data" : str(response) }) else: # Parameter ip ip = request.POST.get('ip') # Parameter port port = request.POST.get('port') # Execute, get result and show it result = ht.getModule('ht_nmap').hasDevicePortOpened( ip=ip, port=port ) if request.POST.get('is_async_hasDevicePortOpened', False): return JsonResponse({ "data" : returnAsModal(result) }) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_hasDevicePortOpened', False): return JsonResponse({ "data" : str(e) }) return renderMainPanel(request=request, popup_text=str(e))
def connect(request): # Init of the view connect try: # Pool call response, repool = sendPool(request, 'connect') if response or repool: if repool: return HttpResponse(response) return JsonResponse({"data": str(response)}) else: # Parameter username username = request.POST.get('username') # Parameter password password = request.POST.get('password') # Execute, get result and show it result = ht.getModule('ht_qualys').connect(username=username, password=password) if request.POST.get('is_async_connect', False): return JsonResponse({"data": returnAsModal(result)}) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_connect', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e))
def decrypt(request): # Init of the view decrypt try: # Pool call response, repool = sendPool(request, 'decrypt') if response or repool: if repool: return HttpResponse(response) return JsonResponse({ "data" : str(response) }) else: # Parameter public_key public_key = tuple(request.POST.get('public_key')) # Parameter ciphertext ciphertext = request.POST.get('ciphertext') # Execute, get result and show it result = ht.getModule('ht_rsa').decrypt( public_key=public_key, ciphertext=ciphertext ) if request.POST.get('is_async_decrypt', False): return JsonResponse({ "data" : result }) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_decrypt', False): return JsonResponse({ "data" : str(e) }) return renderMainPanel(request=request, popup_text=str(e))
def get_timeline(request): # Init of the view get_timeline try: # Pool call response, repool = sendPool(request, 'get_timeline') if response or repool: if repool: return HttpResponse(response) return JsonResponse({ "data" : str(response) }) else: # Parameter username username = request.POST.get('username') # Parameter limit (Optional - Default 1000) limit = int(request.POST.get('limit', 1000)) # Parameter interval (Optional - Default 0) interval = int(request.POST.get('interval', 0)) # Execute, get result and show it result = ht.getModule('ht_twitter').get_timeline( username=username, limit=limit, interval=interval ) if request.POST.get('is_async_get_timeline', False): return JsonResponse({ "data" : returnAsModal(result) }) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_get_timeline', False): return JsonResponse({ "data" : str(e) }) return renderMainPanel(request=request, popup_text=str(e))
def search(request): # Init of the view search try: # Pool call response, repool = sendPool(request, 'search') if response or repool: if repool: return HttpResponse(response) return JsonResponse({"data": str(response)}) else: # Parameter urls urls = request.POST.get('urls') # Parameter gsb_api (Optional - Default None) gsb_api = request.POST.get('gsb_api', None) if not gsb_api: gsb_api = None # Execute, get result and show it result = ht.getModule('ht_phising').search(urls=urls, gsb_api=gsb_api) if request.POST.get('is_async_search', False): return JsonResponse({"data": returnAsModal(result)}) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_search', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e))
def executeScan(request): # Init of the view executeScan try: # Pool call response, repool = sendPool(request, 'executeScan') if response or repool: if repool: return HttpResponse(response) return JsonResponse({ "data" : str(response) }) else: # Parameter ip ip = request.POST.get('ip') # Parameter params (Optional - Default ) params = str(request.POST.get('params', '')) if not params: params = None # Execute, get result and show it result = ht.getModule('ht_nmap').executeScan( ip=ip, params=params ) if request.POST.get('is_async_executeScan', False): return JsonResponse({ "data" : returnAsModal(result) }) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_executeScan', False): return JsonResponse({ "data" : str(e) }) return renderMainPanel(request=request, popup_text=str(e))
def getAPI(request): # Init of the view getAPI try: # Pool call response, repool = sendPool(request, 'getAPI') if response or repool: if repool: return HttpResponse(response) return JsonResponse({"data": str(response)}) else: # Parameter vulndb_api (Optional - Default None) vulndb_api = request.POST.get('vulndb_api', None) if not vulndb_api: vulndb_api = None # Parameter session_id (Optional - Default None) session_id = request.POST.get('session_id', None) if not session_id: session_id = None # Execute, get result and show it result = ht.getModule('ht_vulndb').getAPI(vulndb_api=vulndb_api, session_id=session_id) if request.POST.get('is_async_getAPI', False): return JsonResponse({"data": returnAsModal(result)}) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_getAPI', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e))
def set_pdf_field_value(request): # Init of the view set_pdf_field_value try: # Pool call response, repool = sendPool(request, 'set_pdf_field_value') if response or repool: if repool: return HttpResponse(response) return JsonResponse({"data": str(response)}) else: try: # Save file pdf_file filename_pdf_file, location_pdf_file, pdf_file = saveFileOutput( request.FILES['pdf_file'], 'metadata', 'forensic') except Exception as e: # If not param pdf_file if request.POST.get('is_async_set_pdf_field_value', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e)) # Parameter field field = request.POST.get('field') # Parameter fieldValue fieldValue = request.POST.get('fieldValue') # Execute, get result and show it result = ht.getModule('ht_metadata').set_pdf_field_value( pdf_file=pdf_file, field=field, fieldValue=fieldValue) if request.POST.get('is_async_set_pdf_field_value', False): return JsonResponse({"data": returnAsModal(result)}) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_set_pdf_field_value', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e))
def set_mp3_metadata(request): # Init of the view set_mp3_metadata try: # Pool call response, repool = sendPool(request, 'set_mp3_metadata') if response or repool: if repool: return HttpResponse(response) return JsonResponse({"data": str(response)}) else: try: # Save file mp3_file filename_mp3_file, location_mp3_file, mp3_file = saveFileOutput( request.FILES['mp3_file'], 'metadata', 'forensic') except Exception as e: # If not param mp3_file if request.POST.get('is_async_set_mp3_metadata', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e)) # Parameter title (Optional - Default None) title = request.POST.get('title', None) if not title: title = None # Parameter artist (Optional - Default None) artist = request.POST.get('artist', None) if not artist: artist = None # Parameter album (Optional - Default None) album = request.POST.get('album', None) if not album: album = None # Parameter album_artist (Optional - Default None) album_artist = request.POST.get('album_artist', None) if not album_artist: album_artist = None # Parameter track_num (Optional - Default None) track_num = request.POST.get('track_num', None) if not track_num: track_num = None # Execute, get result and show it result = ht.getModule('ht_metadata').set_mp3_metadata( mp3_file=mp3_file, title=title, artist=artist, album=album, album_artist=album_artist, track_num=track_num) if request.POST.get('is_async_set_mp3_metadata', False): return JsonResponse({"data": returnAsModal(result)}) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_set_mp3_metadata', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e))
def createStub(request): # Init of the view createStub try: # Pool call response, repool = sendPool(request, 'createStub') if response or repool: if repool: return HttpResponse(response) return JsonResponse({"data": str(response)}) else: # Parameter crypto_data_hex crypto_data_hex = request.POST.get('crypto_data_hex') # Parameter public_key public_key = request.POST.get('public_key') try: # Save file drop_file_name filename_drop_file_name, location_drop_file_name, drop_file_name = saveFileOutput( request.FILES['drop_file_name'], 'crypter', 'av_evasion') except Exception as e: # If not param drop_file_name if request.POST.get('is_async_createStub', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e)) # Parameter save_name save_name = request.POST.get('save_name') # Parameter is_iterating (Optional - Default False) is_iterating = request.POST.get('is_iterating', False) if not is_iterating: is_iterating = None # Parameter is_last (Optional - Default False) is_last = request.POST.get('is_last', False) if not is_last: is_last = None # Parameter convert (Optional - Default False) convert = request.POST.get('convert', False) if not convert: convert = None # Execute, get result and show it result = ht.getModule('ht_crypter').createStub( crypto_data_hex=crypto_data_hex, public_key=public_key, drop_file_name=drop_file_name, save_name=save_name, is_iterating=is_iterating, is_last=is_last, convert=convert) if request.POST.get('is_async_createStub', False): return JsonResponse({"data": result}) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_createStub', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e))
def crackZip(request): # Init of the view crackZip try: # Pool call response, repool = sendPool(request, 'crackZip') if response or repool: if repool: return HttpResponse(response) return JsonResponse({"data": str(response)}) else: try: # Save file zipPathName filename_zipPathName, location_zipPathName, zipPathName = saveFileOutput( request.FILES['zipPathName'], 'bruteforce', 'crackers') except Exception as e: # If not param zipPathName if request.POST.get('is_async_crackZip', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e)) # Parameter unzipper (Optional - Default None) unzipper = request.POST.get('unzipper', None) if not unzipper: unzipper = None # Parameter alphabet (Optional - Default lalpha) alphabet = request.POST.get('alphabet', 'lalpha') # Parameter password_length (Optional - Default 4) password_length = request.POST.get('password_length', 4) # Parameter password_pattern (Optional - Default None) password_pattern = request.POST.get('password_pattern', None) if not password_pattern: password_pattern = None # Parameter log (Optional - Default False) log = request.POST.get('log', False) if not log: log = None # Execute, get result and show it result = ht.getModule('ht_bruteforce').crackZip( zipPathName=zipPathName, unzipper=unzipper, alphabet=alphabet, password_length=password_length, password_pattern=password_pattern, log=log) if request.POST.get('is_async_crackZip', False): return JsonResponse({"data": result}) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_crackZip', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e))
def searchTweets(request): # Init of the view searchTweets try: # Pool call response, repool = sendPool(request, 'searchTweets') if response or repool: if repool: return HttpResponse(response) return JsonResponse({ "data" : str(response) }) else: # Parameter username (Optional - Default ) username = str(request.POST.get('username', '')) if not username: username = None # Parameter since (Optional - Default ) since = str(request.POST.get('since', '')) if not since: since = None # Parameter until (Optional - Default ) until = str(request.POST.get('until', '')) if not until: until = None # Parameter query (Optional - Default ) query = str(request.POST.get('query', '')) if not query: query = None # Parameter limit (Optional - Default 1000) limit = int(request.POST.get('limit', 1000)) # Parameter verified (Optional - Default False) verified = int(request.POST.get('verified', False)) # Parameter proxy (Optional - Default ) proxy = str(request.POST.get('proxy', '')) if not proxy: proxy = None # Parameter interval (Optional - Default 0) interval = int(request.POST.get('interval', 0)) # Execute, get result and show it result = ht.getModule('ht_twitter').searchTweets( username=username, since=since, until=until, query=query, limit=limit, verified=verified, proxy=proxy, interval=interval ) if request.POST.get('is_async_searchTweets', False): return JsonResponse({ "data" : returnAsModal(result) }) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_searchTweets', False): return JsonResponse({ "data" : str(e) }) return renderMainPanel(request=request, popup_text=str(e))
def set_pdf_metadata_to_another(request): # Init of the view set_pdf_metadata_to_another try: # Pool call response, repool = sendPool(request, 'set_pdf_metadata_to_another') if response or repool: if repool: return HttpResponse(response) return JsonResponse({"data": str(response)}) else: try: # Save file pdf_file_original filename_pdf_file_original, location_pdf_file_original, pdf_file_original = saveFileOutput( request.FILES['pdf_file_original'], 'metadata', 'forensic') except Exception as e: # If not param pdf_file_original if request.POST.get('is_async_set_pdf_metadata_to_another', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e)) try: # Save file pdf_file_fake filename_pdf_file_fake, location_pdf_file_fake, pdf_file_fake = saveFileOutput( request.FILES['pdf_file_fake'], 'metadata', 'forensic') except Exception as e: # If not param pdf_file_fake if request.POST.get('is_async_set_pdf_metadata_to_another', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e)) # Execute, get result and show it result = ht.getModule('ht_metadata').set_pdf_metadata_to_another( pdf_file_original=pdf_file_original, pdf_file_fake=pdf_file_fake) if result: if os.path.isfile(result): with open(result, 'rb') as fh: response = HttpResponse( fh.read(), content_type="application/{type}".format( type=os.path.split(result)[1].split('.')[1])) response[ 'Content-Disposition'] = 'inline; filename=' + os.path.basename( result) return response return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_set_pdf_metadata_to_another', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e))
def predict(request): # Init of the view predict try: # Pool call response, repool = sendPool(request, 'predict') if response or repool: if repool: return HttpResponse(response) return renderMainPanel(request=request, popup_text=response.text) else: try: # Save file X_img_path filename_X_img_path, location_X_img_path, X_img_path = saveFileOutput( request.FILES['X_img_path'], 'objectdetection', 'ai') except Exception as e: # If not param X_img_path if request.POST.get('is_async_predict', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e)) # Parameter knn_clf (Optional - Default None) knn_clf = request.POST.get('knn_clf', None) if not knn_clf: knn_clf = None try: # Save file model_path (Optional) filename_model_path, location_model_path, model_path = saveFileOutput( request.FILES['model_path'], 'objectdetection', 'ai') except Exception as e: # If not param model_path if request.POST.get('is_async_predict', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e)) # Parameter distance_threshold (Optional - Default 0.6) distance_threshold = request.POST.get('distance_threshold', 0.6) # Execute, get result and show it result = ht.getModule('ht_objectdetection').predict( X_img_path=X_img_path, knn_clf=knn_clf, model_path=model_path, distance_threshold=distance_threshold) if request.POST.get('is_async_predict', False): return JsonResponse({"data": result}) return renderMainPanel(request=request, popup_text=result) except Exception as e: if request.POST.get('is_async_predict', False): return JsonResponse({"data": str(e)}) return renderMainPanel(request=request, popup_text=str(e))