Skip to content

Commit

Permalink
add tools
Browse files Browse the repository at this point in the history
  • Loading branch information
mthcht committed Jul 1, 2024
1 parent 16c27be commit ff2c214
Show file tree
Hide file tree
Showing 682 changed files with 83,960 additions and 82,009 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ result_search.log
tools/O-Q/offensive_tool_keyword.csv
_utils/find_breaking_caracters_before_regex.py
.csv
_utils/list_of_strings.csv
33 changes: 33 additions & 0 deletions _utils/search_strings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import csv
import sys


if len(sys.argv) < 3:
print("list1 contains your list of strings to search (one by line) in the list2 first column\n Usage: python script.py list1.csv list2.csv")
sys.exit(1)

# Paths to the CSV files provided as command-line arguments
file_path1 = sys.argv[1]
file_path2 = sys.argv[2]

# Load the first list from CSV
with open(file_path1, newline='') as file1:
reader1 = csv.reader(file1)
list1 = [row[0] for row in reader1 if row]

# Prepare results dictionary with all entries from list1 set to False initially
results = {string: False for string in list1}

# Stream the second list and check if any string from list1 is a substring of the first column entries
with open(file_path2, newline='') as file2:
reader2 = csv.reader(file2)
for row in reader2:
if row: # Ensure the row is not empty
first_column_entry = row[0] # Only consider the first column of list2
for string in list1:
if string in first_column_entry:
results[string] = True

# Displaying the results
for string, is_found in results.items():
print(f"'{string}' is in list2: {is_found}")
6,280 changes: 3,197 additions & 3,083 deletions greyware_tool_keyword.csv

Large diffs are not rendered by default.

33,292 changes: 16,787 additions & 16,505 deletions offensive_tool_keyword.csv

Large diffs are not rendered by default.

Loading

0 comments on commit ff2c214

Please sign in to comment.