-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbullet.py
72 lines (63 loc) · 2.69 KB
/
bullet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#By SxNade
#https://github.com/SxNade/Bullet
#CONTRIBUTE
import os
import sys
import bcrypt
import time
from termcolor import colored
#importing the required libraries
golo = '''
_/_/_/ _/ _/ _/ _/ _/_/_/_/ _/_/_/_/_/
_/ _/ _/ _/ _/ _/ _/ _/
_/_/_/ _/ _/ _/ _/ _/_/_/ _/
_/ _/ _/ _/ _/ _/ _/ _/
_/_/_/ _/_/ _/_/_/_/ _/_/_/_/ _/_/_/_/ _/
*By SxNade https://github.com/SxNade
'''
version = colored("V1.0", 'red')
#intro function explaining the usage of tool
def intro():
print(golo)
to = '''
USAGE:
#####################################
# #
# python3 bullet.py file-name(path) #
# #
##################################### \n\n\n'''
print(colored(f"[------Bullet {version}-----]" + "\n\n", 'green'))
time.sleep(0.5)
print(colored(f"\n\n{to}", 'white', attrs=['reverse', 'blink']))
#encrypt function that encrypts all the passwords present in the given file
def encrypt():
with open(sys.argv[1], 'r') as file:
for line in file.readlines():
pwd = line.strip()
enc_pass = bcrypt.hashpw(pwd.encode('ascii'), bcrypt.gensalt())
#running file_write function on each encrypted password to save them to a new file
file_write(enc_pass)
print(colored("{succesfully encrypted passwords}", 'white', attrs=['reverse', 'blink']))
#removing the original file with unencrypted contents
os.remove(sys.argv[1])
#Function that makes a new file that will store the encrypted passwords
def file_write(enc_pass):
print(colored("\n\n[*] Encrypted Password written to the ps.txt File", attrs=['reverse', 'blink']))
file = open('ps.txt', 'a')
file.write(f"\n{enc_pass}\n")
file.close()
print(colored("\n[*]Contents Written to File----\n", 'red'))
print("\n\n")
#main function that initiates the execution of whole program and also performs a check on system argument length
def main():
if len(sys.argv) != 3:
intro()
#check if the file to which passwords will be written exists or not
elif os.path.exists('ps.txt') == False or os.path.exists(sys.argv[1]) == False:
intro()
print(colored("\n\n[*] ps.txt or given password File is missing...!!\n", 'red'))
else:
print(golo)
encrypt()
#Finally running the main function to run the whole program
main()