Skip to content

Commit

Permalink
Removed verbosity from shuffle tools
Browse files Browse the repository at this point in the history
  • Loading branch information
frikky committed Feb 28, 2024
1 parent cec44a9 commit 727466a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 38 deletions.
2 changes: 1 addition & 1 deletion shuffle-tools/1.2.0/api.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
app_version: 1.2.0
name: Shuffle Tools
description: A tool app for Shuffle. Gives access to most missing features along with Liquid.
description: A tool app for Shuffle. Gives access to most missing features along with Liquid.
tags:
- Testing
- Shuffle
Expand Down
39 changes: 2 additions & 37 deletions shuffle-tools/1.2.0/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,6 @@ def filter_list(self, input_list, field, check, value, opposite):
new_list.append(item)
found = True
break
else:
print("Nothing matching")

if not found:
failed_list.append(item)
Expand Down Expand Up @@ -1533,7 +1531,7 @@ def fix_json(self, json_data):
del json_data[key]

except Exception as e:
print("[DEBUG] Problem in JSON (fix_json): %s" % e)
pass

return json_data

Expand Down Expand Up @@ -1587,8 +1585,6 @@ def compare_relative_date(
):
if timestamp== "None":
return False

print("Converting input date.")

if date_format == "autodetect":
input_dt = dateutil_parser(timestamp).replace(tzinfo=None)
Expand Down Expand Up @@ -1632,12 +1628,7 @@ def compare_relative_date(
comparison_dt = formatted_dt + delta
#comparison_dt = datetime.datetime.utcnow()

print("{} {} {} is {}. Delta: {}".format(offset, units, direction, comparison_dt, delta))

diff = int((input_dt - comparison_dt).total_seconds())
print(
"\nDifference between {} and {} is {} seconds ({} days)\n".format(timestamp, comparison_dt, diff, int(diff/86400))
)

if units == "seconds":
diff = diff
Expand Down Expand Up @@ -1675,19 +1666,6 @@ def compare_relative_date(
if direction == "ahead" and diff != 0:
result = not (result)

print(
"At {}, is {} {} to {} {} {}? {}. Diff {}".format(
formatted_dt,
timestamp,
equality_test,
offset,
units,
direction,
result,
diff,
)
)

parsed_string = "%s %s %s %s" % (equality_test, offset, units, direction)
newdiff = diff
if newdiff < 0:
Expand Down Expand Up @@ -1804,11 +1782,8 @@ def check_cache_contains(self, key, value, append):
except json.decoder.JSONDecodeError as e:
parsedvalue = [str(allvalues["value"])]
except Exception as e:
print("Error parsing JSON - overriding: %s" % e)
parsedvalue = [str(allvalues["value"])]

print("In ELSE2: '%s'" % parsedvalue)

try:
for item in parsedvalue:
#return "%s %s" % (item, value)
Expand All @@ -1835,7 +1810,6 @@ def check_cache_contains(self, key, value, append):
# Lol
break
except Exception as e:
print("Error in check_cache_contains: %s" % e)
parsedvalue = [str(parsedvalue)]
append = True

Expand Down Expand Up @@ -1888,7 +1862,6 @@ def check_cache_contains(self, key, value, append):
#return allvalues

except Exception as e:
print("[ERROR] Failed to handle cache contains: %s" % e)
return {
"success": False,
"key": key,
Expand Down Expand Up @@ -2197,7 +2170,6 @@ def get_jwt(sa_keyfile,
#signer = crypt.RSASigner.from_service_account_file(sa_keyfile)
signer = crypt.RSASigner.from_string(sa_keyfile)
jwt_token = jwt.encode(signer, payload)
# print(jwt_token.decode('utf-8'))
return jwt_token


Expand Down Expand Up @@ -2435,7 +2407,6 @@ def run_ssh_command(self, host, port, user_name, private_key_file_id, password,
except Exception as e:
return {"success":"false","message":str(e)}
else:
#print("AUTH WITH PASSWORD")
try:
ssh_client.connect(hostname=host,username=user_name,port=port, password=str(password))
except Exception as e:
Expand Down Expand Up @@ -2540,14 +2511,10 @@ def _format_result(self, result):
for i in val:
final_result[key].append(i)
elif isinstance(val, dict):
#print(key,":::",val)
if key in final_result:
if isinstance(val, dict):
for k,v in val.items():
#print("k:",k,"v:",v)
val[k].append(v)
#print(val)
#final_result[key].append([i for i in val if len(val) > 0])
else:
final_result[key] = val

Expand All @@ -2560,7 +2527,6 @@ def _with_concurency(self, array_of_strings, ioc_types):

# Workers dont matter..?
# What can we use instead?
print("Strings:", len(array_of_strings))

workers = 4
with concurrent.futures.ThreadPoolExecutor(max_workers=workers) as executor:
Expand All @@ -2577,7 +2543,6 @@ def _with_concurency(self, array_of_strings, ioc_types):
# Retrieve the results if needed
results = [future.result() for future in futures]

#print("Total time taken:", time.perf_counter()-start)
return self._format_result(results)

# FIXME: Make this good and actually faster than normal
Expand Down Expand Up @@ -2646,7 +2611,7 @@ def parse_ioc_new(self, input_string, input_type="all"):
try:
newarray[i]["is_private_ip"] = ipaddress.ip_address(item["data"]).is_private
except Exception as e:
print("Error parsing %s: %s" % (item["data"], e))
pass

try:
newarray = json.dumps(newarray)
Expand Down

0 comments on commit 727466a

Please sign in to comment.