Sinisterly
Linux Login crack - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Python (https://sinister.ly/Forum-Python)
+--- Thread: Linux Login crack (/Thread-Linux-Login-crack)



Linux Login crack - Stryker Hacking - 05-10-2015

LoginCrack to bruteforce Linux Login password, it will try to Bruteforce Hash and crack it.

Code:
#!/usr/bin/python import sys import crypt import os import threading import argparse flag=0 #console color W = '\033[0m' # white (normal) R = '\033[31m' # red G = '\033[32m' # green O = '\033[33m' # orange B = '\033[34m' # blue P = '\033[35m' # purple if os.getuid() != 0: print R+' [!]'+O+' ERROR:'+G+' logincrack.py'+O+' must be run as '+R+'root'+W print R+' [!]'+O+' login as root ('+W+'su root'+O+') or try '+W+'sudo ./logincrack.py'+W exit(1) def searching(y,salt,hash): if crypt.crypt(y,salt)==hash: print O + "\n[+] " + B + y + "\n" + W class crack: """ This will extract all the user and the hash from the givne input file """ def __init__(self,file,w): self.file=file self.user_hash={} self.f=open(file,'r') self.dict=open(w,'r') def user(self,u): self.u=u for x in self.f: y=x.split(":") if y[0]==u: self.user_hash[u]=y[1] def cracking(self): if self.user_hash: print "user " + R + self.u + W + " found" print P + "Now Cracking " + R + self.u + P +" , be relax" + W print "\nNumber of password tried: " for x in self.user_hash.keys(): hash=self.user_hash[x].split("$")[1:] count=1 for y in self.dict: salt="$"+hash[0]+"$"+hash[1]+"$" t=threading.Thread(target=searching,args=(y.strip('\n'),salt,self.user_hash​[x])) t.start() sys.stdout.write("\r" + R + str(count)+W) count=count+1 else: print R + '[!]'+ O+ " user specified " + B + self.u +R +" not found in file " + P + self.file exit def option(): parser=argparse.ArgumentParser(description="Login hashcracker") parser.add_argument('-u',metavar='user_name',help='username for which the hash will be cracked') parser.add_argument('-d',metavar='dictionary_file',help='file for dictionary attack') parser.add_argument('hash_file',metavar='hash_file',help='the file that contains username and the hash') args=parser.parse_args() c=crack(args.hash_file,args.d) c.user(args.u) c.cracking() if __name__ == '__main__': option()

Usage:
Code:
logincrack.py [-h] [-u user_name] [-d dictionary_file] hash_file

If you like it leave me some feedback thanks guys.


RE: Linux Login crack - roger_smith - 05-10-2015

so this tool has to be run as the root user? Is this for local machine cracking or remote? IT looks like it's for local cracking.


RE: Linux Login crack - ring-1 - 05-11-2015

if you're root and you want access to an account then just use passwd lol
i found the script pretty difficult to read too, space it all out a bit yo
a remote bruteforcing py script would be a bit more significant, local bruteforcing scripts that require you to be root kind of make the script itself redundant lol
and i assume you made this to fuck about with python threading too? i can't argue, this is more practical than the first threaded tool i made lol
gj


RE: Linux Login crack - roger_smith - 05-11-2015

(05-11-2015, 06:02 AM)ring-1 Wrote: if you're root and you want access to an account then just use passwd lol
i found the script pretty difficult to read too, space it all out a bit yo
a remote bruteforcing py script would be a bit more significant, local bruteforcing scripts that require you to be root kind of make the script itself redundant lol
and i assume you made this to fuck about with python threading too? i can't argue, this is more practical than the first threaded tool i made lol
gj

That's why I was asking about this too. Exactly, if you're already root, you can just su - to whatever user you want. The only time we've needed to actually crack passwords is when we're doing password audits.