socx 2.1__tar.gz → 2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: socx
3
- Version: 2.1
3
+ Version: 2.2
4
4
  Summary: A set of useful tools for a security operations center
5
5
  Author-email: Enlace <enlace.aman@gmail.com>
6
6
  Classifier: Programming Language :: Python :: 3
@@ -14,6 +14,9 @@ A collection of helpful tools for a SOC analyst. Easily search for IPs, domains,
14
14
  ## Installing
15
15
  python -m pip install socx
16
16
 
17
+ ### Installing from QA
18
+ python -m pip install --index-url https://test.pypi.org/simple/ socx
19
+
17
20
  ## Usage
18
21
  A tool to assist with day to day activites in a security operations center (pronounced "socks")
19
22
 
@@ -4,6 +4,9 @@ A collection of helpful tools for a SOC analyst. Easily search for IPs, domains,
4
4
  ## Installing
5
5
  python -m pip install socx
6
6
 
7
+ ### Installing from QA
8
+ python -m pip install --index-url https://test.pypi.org/simple/ socx
9
+
7
10
  ## Usage
8
11
  A tool to assist with day to day activites in a security operations center (pronounced "socks")
9
12
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "socx"
7
- version = "2.1"
7
+ version = "2.2"
8
8
  authors = [
9
9
  { name="Enlace", email="enlace.aman@gmail.com" },
10
10
  ]
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
3
  from contextlib import suppress
4
+ import subprocess
4
5
  from unittest import skipUnless
6
+ from urllib.parse import unquote
5
7
 
6
8
  try:
7
9
  import argparse
@@ -48,6 +50,8 @@ ABOUT = f"""
48
50
 
49
51
  Version: {VERSION}
50
52
  A tool to assist with day to day activites in a security operations center (pronounced "socks")
53
+
54
+ Visit https://enlace.one/ for more information.
51
55
  """
52
56
  USAGE = f"""Usage:
53
57
  {PROGRAM_NAME} [universal options] [function] [arguments]
@@ -82,9 +86,8 @@ def p(*args_, v=1, end="\n", sep=" ", file=None):
82
86
 
83
87
  def unwrap_url(url):
84
88
  pp_decoder = util.URLDefenseDecoder()
85
- url = pp_decoder.decode(url)
86
89
  if "safelinks" in url:
87
- url = url.split("url=")[1]
90
+ url = unquote(url.split("url=")[1])
88
91
  url = pp_decoder.decode(url)
89
92
  return url
90
93
 
@@ -487,6 +490,26 @@ def do_command_history(user="~"):
487
490
  p("Command history gathered", v=3)
488
491
 
489
492
 
493
+ def awake(minutes=60):
494
+ interval = 10 # seconds
495
+ iterations = (minutes * 60) / interval
496
+
497
+ p(f"Keeping the device awake for {minutes} minutes...")
498
+ cmd = [
499
+ "powershell",
500
+ "-Command",
501
+ "$WShell = New-Object -ComObject 'WScript.Shell'; "
502
+ f"for ($i = 0; $i -lt {iterations}; $i++) {{ "
503
+ f"$WShell.SendKeys('%'); Start-Sleep -Seconds {interval}; $temp = [Math]::Round(($i*{interval})/60, 1); Write-Output \"$temp of {minutes}. CTRL+C to End\"}}",
504
+ ]
505
+
506
+ with subprocess.Popen(
507
+ cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True
508
+ ) as proc:
509
+ for line in proc.stdout:
510
+ print(line, end="")
511
+
512
+
490
513
  #############
491
514
  # Arguments #
492
515
  #############.
@@ -506,6 +529,24 @@ FUNCTIONS = [
506
529
  "function": lambda: interactive_mode(),
507
530
  "arguments": [],
508
531
  },
532
+ {
533
+ "name": "Stay Awake",
534
+ "command": "awake",
535
+ "help": "",
536
+ "function": awake,
537
+ "arguments": [
538
+ {
539
+ "name": "minutes",
540
+ "flag": "--minutes",
541
+ "short_flag": "-m",
542
+ "prompt": "Enter number of minutes to run for: ",
543
+ "type": int,
544
+ "default": 60,
545
+ "required": False,
546
+ "help": "Keeps device awake for this many minutes",
547
+ },
548
+ ],
549
+ },
509
550
  {
510
551
  "name": "Combine CSVs",
511
552
  "command": "combine",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: socx
3
- Version: 2.1
3
+ Version: 2.2
4
4
  Summary: A set of useful tools for a security operations center
5
5
  Author-email: Enlace <enlace.aman@gmail.com>
6
6
  Classifier: Programming Language :: Python :: 3
@@ -14,6 +14,9 @@ A collection of helpful tools for a SOC analyst. Easily search for IPs, domains,
14
14
  ## Installing
15
15
  python -m pip install socx
16
16
 
17
+ ### Installing from QA
18
+ python -m pip install --index-url https://test.pypi.org/simple/ socx
19
+
17
20
  ## Usage
18
21
  A tool to assist with day to day activites in a security operations center (pronounced "socks")
19
22
 
@@ -37,22 +37,34 @@ def test_find_file():
37
37
  ## Getting hung up
38
38
  # def test_find_file_with_regex():
39
39
  # output = run(
40
- # "-v 5 find --regex -f 'Phineas.*Ferb.txt' -d 'C:\\Users\\colli\\OneDrive\\Documents\\Python\\socX\\tests\\test_files'"
40
+ # "-v 5 find --regex -f 'Phineas.*Ferb.txt' -d ''"
41
41
  # )
42
42
  # assert output.stderr == ""
43
43
  # assert "\\PhineasAndFerb.txt" in str(output.stdout)
44
44
 
45
45
 
46
- def test_unwrap_url():
47
- test_url = "https://urldefense.com/v3/__https:/conferences.stjude.org/g87vv8?i=2NejfAgCkki403xbcRpHuw&locale=en-US__;!!NfcMrC8AwgI!cq3afLDXviFyix2KeJ62VsQBrrZOgfyZu1fks7uQorRGX6VOgcDaUgTpxFdJRmXMdtU5zsmZB9PUw-TmquYgbIGIYUDPsQ$"
48
- output = run(
49
- f"unwrap --url '{test_url}' ",
50
- )
51
- assert output.stderr == ""
52
- assert (
53
- "https://conferences.stjude.org/g87vv8?i=2NejfAgCkki403xbcRpHuw&locale=en-US"
54
- in str(output.stdout)
55
- )
46
+ # def test_unwrap_url():
47
+ # test_url = "https://urldefense.com/v3/__https:/conferences.stjude.org/g87vv8?i=2NejfAgCkki403xbcRpHuw&locale=en-US__;!!NfcMrC8AwgI!cq3afLDXviFyix2KeJ62VsQBrrZOgfyZu1fks7uQorRGX6VOgcDaUgTpxFdJRmXMdtU5zsmZB9PUw-TmquYgbIGIYUDPsQ$"
48
+ # output = run(
49
+ # f"unwrap --url '{test_url}' ",
50
+ # )
51
+ # assert output.stderr == ""
52
+ # assert (
53
+ # "https://conferences.stjude.org/g87vv8?i=2NejfAgCkki403xbcRpHuw&locale=en-US"
54
+ # in str(output.stdout)
55
+ # )
56
+
57
+
58
+ # def test_unwrap_safelink_url():
59
+ # test_url = "https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Foutlook.office365.com%2Fowa%2F%3FItemID%3DAAkALgAAAAAAHYQDEapmEc2byACqAC%252FEWg0AEtOij2Wdn0uk%252Bvzsc82xogACnMa3jwAA%26exvsurl%3D1%26viewmodel%3DReadMessageItem%26nativeOutlookCommand%3DopenMessage&data=05%7C02%7CCollin.Peel%40alsac.stjude.org%7C870e10f064af483039e608ddc580ff4a%7C62a96f9aa5614bfba97870a73a08dc02%7C0%7C0%7C638883880016710627%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=JiZTfR8E3%2FPCVauhcSsanHVYDR0ETfRKP1Gzjrd2ppc%3D&reserved=0"
60
+ # output = run(
61
+ # f"unwrap --url '{test_url}' ",
62
+ # )
63
+ # assert output.stderr == ""
64
+ # assert (
65
+ # "https://outlook.office365.com/owa/?ItemID=AAkALgAAAAAAHYQDEapmEc2byACqAC%2FEWg0AEtOij2Wdn0uk%2Bvzsc82xogACnMa3jwAA&exvsurl=1&viewmodel=ReadMessageItem&nativeOutlookCommand=openMessage"
66
+ # in str(output.stdout)
67
+ # )
56
68
 
57
69
 
58
70
  ## This one has issues with testing but does seem to work
File without changes
File without changes
File without changes
File without changes
File without changes