|
16 | 16 | blacklist = [".exe",".jar",".doc",".docx",".cpl",".scr"] |
17 | 17 | ext = os.path.splitext(sys.argv[1])[1] |
18 | 18 |
|
| 19 | +#Userhash for uploads to account |
| 20 | +userhash="" |
| 21 | +if os.path.exists(os.path.dirname(sys.argv[0])+"\Catboxer.conf"): |
| 22 | + with open(os.path.dirname(sys.argv[0])+"\Catboxer.conf",'r') as file: |
| 23 | + userhash=file.read().rstrip() |
| 24 | + print("Uploading to logged in account") |
| 25 | +else: |
| 26 | + print("Uploading anonymously") |
| 27 | + |
| 28 | + |
19 | 29 |
|
20 | 30 | try: |
21 | 31 | #if a folder is to be uploaded, zip it |
|
29 | 39 | exit() |
30 | 40 | apidata={ |
31 | 41 | 'reqtype': (None, 'fileupload'), |
| 42 | + 'userhash':(None,userhash), |
32 | 43 | 'fileToUpload': (sys.argv[1]+".zip", open(sys.argv[1]+".zip", 'rb')), |
33 | 44 | } |
34 | 45 | #If file with blacklisted ext is to be uploaded, zip it |
|
43 | 54 | zip.write(os.path.basename(sys.argv[1])) |
44 | 55 | apidata={ |
45 | 56 | 'reqtype': (None, 'fileupload'), |
| 57 | + 'userhash':(None,userhash), |
46 | 58 | 'fileToUpload': (sys.argv[1][:-4]+".zip", open(sys.argv[1][:-4]+".zip", 'rb')), |
47 | 59 | } |
48 | 60 | else: |
|
53 | 65 | exit() |
54 | 66 | apidata={ |
55 | 67 | 'reqtype': (None, 'fileupload'), |
| 68 | + 'userhash':(None,userhash), |
56 | 69 | 'fileToUpload': (sys.argv[1], open(sys.argv[1], 'rb')), |
57 | 70 | } |
58 | 71 |
|
|
0 commit comments