EntySec / HatSploit

Modular penetration testing platform that enables you to write, test, and execute exploit code.
https://hatsploit.com
MIT License
277 stars 62 forks source link

no permissons and ```log``` #66

Closed thecakeisfalse closed 2 years ago

thecakeisfalse commented 2 years ago

if you try to create file in root directory and you don't have permissions, hsf dies

(hsf)> log on /file.txt
[i] HatSploit log: on
[-] An error occurred: [Errno 13] Permission denied: '/file.txt'!
Traceback (most recent call last):
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/base/console.py", line 87, in launch_menu
    self.execute.execute_command(commands, arguments)
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/base/execute.py", line 47, in execute_command
    if not self.execute_core_command(commands, arguments):
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/base/execute.py", line 90, in execute_core_command
    command.run(len(arguments), arguments)
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/lib/../commands/log.py", line 42, in run
    self.print_information("HatSploit log: on")
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/cli/badges.py", line 64, in print_information
    self.print_empty(self.I + message, start=start, end=end)
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/cli/badges.py", line 46, in print_empty
    self.io.print(message, start=start, end=end)
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/base/io.py", line 49, in print
    with open(use_log, 'a') as f:
PermissionError: [Errno 13] Permission denied: '/file.txt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/thecakeisfalse/.local/bin/hsf", line 8, in <module>
    sys.exit(main())
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/hsf.py", line 169, in main
    hsf.launch(script=hsf.root_path + 'startup.hsf')
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/hsf.py", line 93, in launch
    self.console.script(script, do_shell)
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/base/console.py", line 179, in script
    self.launch_menu()
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/base/console.py", line 94, in launch_menu
    self.badges.print_error("An error occurred: " + str(e) + "!")
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/cli/badges.py", line 58, in print_error
    self.print_empty(self.E + message, start=start, end=end)
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/cli/badges.py", line 46, in print_empty
    self.io.print(message, start=start, end=end)
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/base/io.py", line 49, in print
    with open(use_log, 'a') as f:
PermissionError: [Errno 13] Permission denied: '/file.txt'
bruh@bruh:~$ 
thecakeisfalse commented 2 years ago

@enty8080

thecakeisfalse commented 2 years ago

and if you restart you will have this issue

Traceback (most recent call last):
  File "/home/thecakeisfalse/.local/bin/hsf", line 8, in <module>
    sys.exit(main())
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/hsf.py", line 169, in main
    hsf.launch(script=hsf.root_path + 'startup.hsf')
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/hsf.py", line 93, in launch
    self.console.script(script, do_shell)
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/base/console.py", line 162, in script
    self.launch_shell()
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/base/console.py", line 115, in launch_shell
    self.badges.print_empty(self.colors.CLEAR, end='')
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/cli/badges.py", line 46, in print_empty
    self.io.print(message, start=start, end=end)
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/base/io.py", line 49, in print
    with open(use_log, 'a') as f:
PermissionError: [Errno 13] Permission denied: '/file.txt'
enty8080 commented 2 years ago

ok

thecakeisfalse commented 2 years ago

thx

thecakeisfalse commented 2 years ago

@enty8080 when will you fix my issue?

enty8080 commented 2 years ago

it's fixed

thecakeisfalse commented 2 years ago

@enty8080 no it isn't fixed

enty8080 commented 2 years ago

ok https://github.com/EntySec/HatSploit/blob/98d6d22314d57fd072010165598f49663bb795f3/hatsploit/commands/log.py#L44

thecakeisfalse commented 2 years ago
(hsf)> log on /file.txt
[i] HatSploit log: on
[-] An error occurred: [Errno 13] Permission denied: '/file.txt'!
Traceback (most recent call last):
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/base/console.py", line 87, in launch_menu
    self.execute.execute_command(commands, arguments)
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/base/execute.py", line 49, in execute_command
    if not self.execute_core_command(commands, arguments):
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/base/execute.py", line 93, in execute_core_command
    command.run(len(arguments), arguments)
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/lib/../commands/log.py", line 47, in run
    self.print_information("HatSploit log: on")
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/cli/badges.py", line 64, in print_information
    self.print_empty(self.I + message, start=start, end=end)
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/cli/badges.py", line 46, in print_empty
    self.io.print(message, start=start, end=end)
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/base/io.py", line 49, in print
    with open(use_log, 'a') as f:
PermissionError: [Errno 13] Permission denied: '/file.txt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/thecakeisfalse/.local/bin/hsf", line 8, in <module>
    sys.exit(main())
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/hsf.py", line 169, in main
    hsf.launch(script=hsf.root_path + 'startup.hsf')
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/hsf.py", line 93, in launch
    self.console.script(script, do_shell)
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/base/console.py", line 167, in script
    self.launch_menu()
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/base/console.py", line 94, in launch_menu
    self.badges.print_error("An error occurred: " + str(e) + "!")
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/cli/badges.py", line 58, in print_error
    self.print_empty(self.E + message, start=start, end=end)
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/cli/badges.py", line 46, in print_empty
    self.io.print(message, start=start, end=end)
  File "/home/thecakeisfalse/.local/lib/python3.8/site-packages/hatsploit/core/base/io.py", line 49, in print
    with open(use_log, 'a') as f:
PermissionError: [Errno 13] Permission denied: '/file.txt'
thecakeisfalse commented 2 years ago

i reinstalled hsf twice before running

enty8080 commented 2 years ago

@thecakeisfalse I fixed this problem, can you accept that it works properly?

https://github.com/EntySec/HatSploit/blob/fab80e27feeee9900dc6734046524c257c59abad/hatsploit/commands/log.py#L42

thecakeisfalse commented 2 years ago

@enty8080 yes, it works correct, thanks