Suggestions implemented

This commit is contained in:
SovereigntyIsNotFreedom 2025-04-17 02:20:53 -04:00
parent e044ba56e9
commit aeb3b16a9b
4 changed files with 75 additions and 63 deletions

2
.gitignore vendored
View file

@ -4,4 +4,4 @@ crawler/**
scripts/__pycache__/** scripts/__pycache__/**
.env .env
env/ env/
submissions submissions/**

View file

@ -129,6 +129,8 @@ def main():
blcsvfile=instancepath+'/blacklist.csv' blcsvfile=instancepath+'/blacklist.csv'
secsvfile=instancepath+'/sensitive.csv' secsvfile=instancepath+'/sensitive.csv'
webpcsvfile=instancepath+'/webring-participants.csv' webpcsvfile=instancepath+'/webring-participants.csv'
submission_file_abs_path = os.path.abspath('submissions/submission.csv')
if not os.path.exists(instancepath): if not os.path.exists(instancepath):
print_colors(f"{rootpath}",is_error=True, bold=True) print_colors(f"{rootpath}",is_error=True, bold=True)
os.makedirs(instancepath) os.makedirs(instancepath)
@ -179,7 +181,7 @@ Managing Wordlists:
Maintenance: Maintenance:
9) Remove the duplicate URLs for your own instance 9) Remove the duplicate URLs for your own instance
10) Perform sanity checks on all csv files for all instances (to mark them as sensitive / or remove the ones that are blacklisted) 10) Perform sanity checks on all csv files for all instances (to mark them as sensitive / or remove the ones that are blacklisted)
11) Review submissions and add to verified, unverfied csv files or delete them 11) Review submissions (Add to verified.csv/ add to unverified.csv/ delete /blacklist)
0) Exit 0) Exit
""") """)
@ -1201,73 +1203,82 @@ Maintenance:
case 11: case 11:
try: try:
print_colors("1) Move entries to verified 2) Move entries from submission to unverified 3) Delete from submission file 0) exit") print_colors("1) Move entries to verified 2) Move entries from submission to unverified 3) Delete from submission file 4) Add to blacklist -1) exit")
option = int(input("Enter an option: "))
# can't use instance variable because it will go inside www submission_df = pd.read_csv(submission_file_abs_path)
submission_csv_file = "../submissions/submission.csv"
submission_df = pd.read_csv(submission_csv_file)
verified_csv_df = pd.read_csv(verifiedcsvfile) verified_csv_df = pd.read_csv(verifiedcsvfile)
unverified_csv_df = pd.read_csv(unverifiedcsvfile) unverified_csv_df = pd.read_csv(unverifiedcsvfile)
blacklist_df = pd.read_csv(blcsvfile)
match option: blacklisted_words = [word for word in blacklist_df['blacklisted-words']]
case 1: for i, row in submission_df.iterrows():
while len(submission_df) != 0: print_colors(row)
print_colors(submission_df) link = row['link']
indx = int(input("Which index do you want to add? -1 to exit: ")) if link in blacklisted_words:
if indx == -1: break print_colors("Black listed entry found", bold=True)
link = submission_df.iloc[indx]['link'].strip() continue
name = submission_df.iloc[indx]['name'].strip() else:
desc = submission_df.iloc[indx]['desc'].strip() name = row['name']
category = submission_df.iloc[indx]['category'].strip() desc = row['desc']
sensitive = "YES" if submission_df.iloc[indx]['sensitive'].strip() == 'y' else "NO" category = row['category']
sensi = "YES" if row['sensitive'] == 'y' else "NO"
number = int(input("Enter an option: "))
if number == 1:
newrow=[instance,category,name,link,sensi,desc,'YES','100']
verified_csv_df.loc[-1] = newrow # adding a row
new_row = pd.DataFrame({'Instance': [instance], 'Category': [category], 'Name':[name],'URL':[link],'Sensitive':[sensitive],'Description':[desc],'Status':['YES'],'Score':['100']}) verified_csv_df.index = verified_csv_df.index + 1 # shifting index
verified_csv_df = verified_csv_df.sort_index() # sorting by index
verified_csv_df = verified_csv_df.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
print_colors("[+] New row added! now writing the csv file")
verified_csv_df.to_csv(verifiedcsvfile, index=False)
submission_df.drop(index=i,inplace=True)
submission_df.to_csv(submission_file_abs_path, index=False)
if number == 2:
df = pd.concat([verified_csv_df, new_row], ignore_index=True) newrow=[instance,category,name,link,sensi,desc,'YES','100']
df.to_csv(verifiedcsvfile, index=False)
submission_df.drop(index=indx, inplace=True)
submission_df.to_csv(submission_csv_file, index=False)
case 2: unverified_csv_df.loc[-1] = newrow # adding a row
while len(submission_df)!=0: unverified_csv_df.index = unverified_csv_df.index + 1 # shifting index
print_colors(submission_df) unverified_csv_df = unverified_csv_df.sort_index() # sorting by index
indx = int(input("Which index do you want to add? -1 to exit: ")) unverified_csv_df = unverified_csv_df.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
if indx == -1: break print_colors("[+] New row added! now writing the csv file")
link = submission_df.iloc[indx]['link'].strip() unverified_csv_df.to_csv(unverifiedcsvfile, index=False)
name = submission_df.iloc[indx]['name'].strip() submission_df.drop(index=i,inplace=True)
desc = submission_df.iloc[indx]['desc'].strip() submission_df.to_csv(submission_file_abs_path, index=False)
category = submission_df.iloc[indx]['category'].strip()
sensitive = "YES" if submission_df.iloc[indx]['sensitive'].strip() == 'y' else "NO" if number == 3:
new_row = pd.DataFrame({'Instance': [instance], 'Category': [category], 'Name':[name],'URL':[link],'Sensitive':[sensitive],'Description':[desc],'Status':['YES'],'Score':['100']}) submission_df.drop(index=i,inplace=True)
submission_df.to_csv(submission_file_abs_path, index=False)
df = pd.concat([unverified_csv_df, new_row], ignore_index=True) if number == 4:
df.to_csv(unverifiedcsvfile, index=False) newrow=[link]
submission_df.drop(index=indx,inplace=True)
submission_df.to_csv(submission_csv_file, index=False)
case 3: blacklist_df.loc[-1] = newrow # adding a row
while len(submission_df) != 0: blacklist_df.index = blacklist_df.index + 1 # shifting index
print_colors(submission_df) blacklist_df = blacklist_df.sort_index() # sorting by index
indx = int(input("Enter which row should be removed(-2 for all, -1 to exit): ")) print_colors("[+] New row added! now writing the csv file")
if indx == -1: blacklist_df.to_csv(blcsvfile, index=False)
break submission_df.drop(index=i,inplace=True)
elif indx == -2: submission_df.to_csv(submission_file_abs_path, index=False)
for i in range(0, len(submission_df)):
submission_df.drop(index=i, inplace=True)
submission_df.to_csv(submission_csv_file, index=False)
else:
submission_df.drop(index=indx, inplace=True)
submission_df.to_csv(submission_csv_file, index=False)
case 0: if number == -1:
break break
else:
print_colors("Invalid Number",is_error=True)
continue
except Exception as e: except Exception as e:
print_colors(f'Try again {e}',is_error=True) print_colors(f'Try again {e}',is_error=True)
break break
finally:
print_colors("End of file")
break break
case 0: case 0:
print_colors(f"[-] Exiting", bold=True) print_colors(f"[-] Exiting", bold=True)
@ -1277,4 +1288,4 @@ Maintenance:
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View file

@ -1,2 +1,2 @@
link,name,desc,category,sensitive link,name,desc,category,sensitive
dsajkdasl,jkldjaslkjdl,jdklasjdlkjl,jklsjlkdaj,y

1 link name desc category sensitive
2

View file

@ -1,6 +1,7 @@
To make the captcha image work you will need to install php-gd. ## Configuration for php to work
Since there might be version in the name first try searching your package manager - To make the captcha image work you will need to install php-gd.
- Since there might be version in the name first try searching your package manager
Next you need to go to /etc/php/[your_version]/cli/php.ini and remove the semi-colon(;) from the line with extension=gd. - Next you need to go to /etc/php/[your_version]/cli/php.ini and remove the semi-colon(;) from the line with extension=gd.
- Make sure to use chmod 777 on submission.csv file
Done. Done.