Skip to content

Commit

Permalink
Fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
paveldat committed Oct 12, 2024
1 parent 6fa17ab commit 96e96fe
Show file tree
Hide file tree
Showing 14 changed files with 410 additions and 415 deletions.
127 changes: 64 additions & 63 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,65 @@
# gods_eye changelog

## 1.2.0

- Add ProbivApiPhoneInfo class for searching information by phone number using probivapi.com

## 1.1.2
- Changed README

## 1.1.1
- Remove unused dependencies

## 1.1.0
- Update pipeline

## 1.0.9
- Add one_sec_mail tool.
- Update README

## 1.0.8
- Add status badge Markdown

## 1.0.7
- Fix release job to publish release package.

## 1.0.6
- Add pipeline.
Add deploy to PyPI.
Add tests and code check.

## 1.0.5
- Pylint check code style

## 1.0.4
- `phone_info` modification.
Now the map can be saved in the specified path.

## 1.0.3
- Added tools:
- phone_info
Gets country, operator and location by phone number.

## 1.0.2
- Added tools:
- pwned
Checks if your password has been compromised in a data breach.

## 1.0.1
- Added tools:
- ip_info_finder
This tool works for Domain or IP addresses

- Added error handler

## 1.0.0
- Added tools:
- clickjacking
- exec_shell_command
- http_headers_grabber
- ip
- logger
- nmap_scanner
- robots_scaner
# gods_eye changelog

## 1.2.0

- Add ProbivApiPhoneInfo class for searching information by phone number using probivapi.com
- Fix code style

## 1.1.2
- Changed README

## 1.1.1
- Remove unused dependencies

## 1.1.0
- Update pipeline

## 1.0.9
- Add one_sec_mail tool.
- Update README

## 1.0.8
- Add status badge Markdown

## 1.0.7
- Fix release job to publish release package.

## 1.0.6
- Add pipeline.
Add deploy to PyPI.
Add tests and code check.

## 1.0.5
- Pylint check code style

## 1.0.4
- `phone_info` modification.
Now the map can be saved in the specified path.

## 1.0.3
- Added tools:
- phone_info
Gets country, operator and location by phone number.

## 1.0.2
- Added tools:
- pwned
Checks if your password has been compromised in a data breach.

## 1.0.1
- Added tools:
- ip_info_finder
This tool works for Domain or IP addresses

- Added error handler

## 1.0.0
- Added tools:
- clickjacking
- exec_shell_command
- http_headers_grabber
- ip
- logger
- nmap_scanner
- robots_scaner
- whois_lookup
38 changes: 19 additions & 19 deletions src/clickjacking/clickjacking.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,15 @@
▒▐█░░░▐█─░▐█░▒▀▄▀░░▐█▄▄▒██▄▄█░▐█▄█▀░▐█─░▐█░▒▄█▄░
"""

import sys
import logging
import sys

sys.path.insert(
0,
'src'
)
sys.path.insert(0, "src")

from logger.logger import Logger
from http_headers_grabber.http_headers_grabber import HttpHeadersGrabber
from logger.logger import Logger


logger = Logger('ClickJacking')
logger = Logger("ClickJacking")


class ClickJacking:
Expand All @@ -44,24 +40,28 @@ def click_jacking(target: str, debug: bool = False) -> bool:
logger.setLevel(logging.DEBUG)

if not isinstance(target, str):
logger.raise_fatal(BaseException(f'Target must be a string not {type(target)}. '
f'Got target: {target}'))
logger.raise_fatal(
BaseException(
f"Target must be a string not {type(target)}. "
f"Got target: {target}"
)
)

target = target.lower()
if not (target.startswith('http://') or target.startswith('https://')):
target = 'http://' + target
if not (target.startswith("http://") or target.startswith("https://")):
target = "http://" + target

logger.info(f'Testing ClickJacking for {target}')
logger.info(f"Testing ClickJacking for {target}")

try:
headers = HttpHeadersGrabber.http_headers_grabber(target)

if 'X-Frame-Options' in headers.keys():
logger.debug('ClickJacking Header is present')
logger.debug('You can\'t clickjack this domain')
if "X-Frame-Options" in headers.keys():
logger.debug("ClickJacking Header is present")
logger.debug("You can't clickjack this domain")
return False
logger.debug('ClickJacking Header is missing')
logger.debug('This domain is vulnerable to ClickJacking')
logger.debug("ClickJacking Header is missing")
logger.debug("This domain is vulnerable to ClickJacking")
return True
except Exception as ex:
logger.raise_fatal(BaseException(f'Error occurred: {ex}'))
logger.raise_fatal(BaseException(f"Error occurred: {ex}"))
31 changes: 15 additions & 16 deletions src/dns_lookup/dns_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,16 @@
▒▐█░░░▐█─░▐█░▒▀▄▀░░▐█▄▄▒██▄▄█░▐█▄█▀░▐█─░▐█░▒▄█▄░
"""


import sys
import logging
import sys

import dns.resolver

sys.path.insert(
0,
'src'
)
sys.path.insert(0, "src")

from logger.logger import Logger


logger = Logger('DnsLookup')
logger = Logger("DnsLookup")


class DnsLookup:
Expand All @@ -35,8 +31,7 @@ class DnsLookup:
"""

@staticmethod
def dns_lookup(target: str, record_type: str = 'A',
debug: bool = False) -> list:
def dns_lookup(target: str, record_type: str = "A", debug: bool = False) -> list:
"""
Looks for dns lookup information for IP or Domain.
Expand All @@ -53,16 +48,20 @@ def dns_lookup(target: str, record_type: str = 'A',
logger.setLevel(logging.DEBUG)

if not isinstance(target, str):
logger.raise_fatal(BaseException(f'Target must be a string not {type(target)}. '
f'Got target: {target}'))
logger.raise_fatal(
BaseException(
f"Target must be a string not {type(target)}. "
f"Got target: {target}"
)
)

ipvs = []
logger.info(f'DNS Lookup: {target.lower()}')
logger.info(f'Records to find out: {record_type}')
logger.info(f"DNS Lookup: {target.lower()}")
logger.info(f"Records to find out: {record_type}")
try:
for ipval in dns.resolver.resolve(target.lower(), record_type):
ipvs.append(ipval.to_text())
logger.debug(record_type + ' : ' + ipval.to_text())
logger.debug(record_type + " : " + ipval.to_text())
return ipvs
except Exception as ex:
logger.raise_fatal(BaseException(f'Error occurred: {ex}'))
logger.raise_fatal(BaseException(f"Error occurred: {ex}"))
14 changes: 5 additions & 9 deletions src/exec_shell_command/exec_shell_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,15 @@
▒▐█░░░▐█─░▐█░▒▀▄▀░░▐█▄▄▒██▄▄█░▐█▄█▀░▐█─░▐█░▒▄█▄░
"""

import sys
import logging
from subprocess import Popen, PIPE
import sys
from subprocess import PIPE, Popen

sys.path.insert(
0,
'src'
)
sys.path.insert(0, "src")

from logger.logger import Logger


logger = Logger('exec_commands')
logger = Logger("exec_commands")


def exec_shell_command(command: str, debug: bool = False) -> str:
Expand All @@ -38,7 +34,7 @@ def exec_shell_command(command: str, debug: bool = False) -> str:
if debug:
logger.setLevel(logging.DEBUG)

logger.info(f'Executing command: `{command}`')
logger.info(f"Executing command: `{command}`")
with Popen(command, shell=True, stdout=PIPE, stderr=PIPE) as proc:
status = proc.wait()
output = proc.stdout.read().decode(sys.stdout.encoding)
Expand Down
29 changes: 15 additions & 14 deletions src/http_headers_grabber/http_headers_grabber.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@
▒▐█░░░▐█─░▐█░▒▀▄▀░░▐█▄▄▒██▄▄█░▐█▄█▀░▐█─░▐█░▒▄█▄░
"""

import sys
import logging
import sys

import requests

sys.path.insert(
0,
'src'
)
sys.path.insert(0, "src")

from logger.logger import Logger


logger = Logger('HttpGrabber')
logger = Logger("HttpGrabber")


class HttpHeadersGrabber:
Expand All @@ -44,15 +41,19 @@ def http_headers_grabber(target: str, debug: bool = False) -> dict:
logger.setLevel(logging.DEBUG)

if not isinstance(target, str):
logger.raise_fatal(BaseException(f'Target must be a string not {type(target)}. '
f'Got target: {target}'))
logger.raise_fatal(
BaseException(
f"Target must be a string not {type(target)}. "
f"Got target: {target}"
)
)

try:
if not (target.startswith('http://') or target.startswith('https://')):
target = 'http://' + target
if not (target.startswith("http://") or target.startswith("https://")):
target = "http://" + target
response = requests.get(target.lower())
logger.info(f'Got {target} request: {response.status_code}')
logger.debug(f'Headers:\n {response.headers}')
logger.info(f"Got {target} request: {response.status_code}")
logger.debug(f"Headers:\n {response.headers}")
return response.headers
except Exception as ex:
logger.raise_fatal(BaseException(f'Error occurred: {ex}'))
logger.raise_fatal(BaseException(f"Error occurred: {ex}"))
27 changes: 11 additions & 16 deletions src/ip/ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,17 @@
▒▐█░░░▐█─░▐█░▒▀▄▀░░▐█▄▄▒██▄▄█░▐█▄█▀░▐█─░▐█░▒▄█▄░
"""

import sys
import socket
import logging
import re as r
import socket
import sys
from urllib.request import urlopen

sys.path.insert(
0,
'src'
)
sys.path.insert(0, "src")

from logger.logger import Logger


logger = Logger('GetHostname')
logger = Logger("GetHostname")


class GetHostname:
Expand All @@ -37,9 +33,9 @@ def get_hostname(self) -> str:
* Hostname
"""

logger.info('Getting hostname')
logger.info("Getting hostname")
hostname = socket.gethostname()
logger.debug(f'Hostname: {hostname}')
logger.debug(f"Hostname: {hostname}")
return hostname

def get_ip(self) -> str:
Expand All @@ -50,11 +46,10 @@ def get_ip(self) -> str:
* Local IP
"""

logger.info('Getting IP')
request = str(urlopen('http://checkip.dyndns.com/').read())
local_ip = r.compile(r'Address: (\d+\.\d+\.\d+\.\d+)').search(
request).group(1)
logger.debug(f'IP: {local_ip}')
logger.info("Getting IP")
request = str(urlopen("http://checkip.dyndns.com/").read())
local_ip = r.compile(r"Address: (\d+\.\d+\.\d+\.\d+)").search(request).group(1)
logger.debug(f"IP: {local_ip}")
return local_ip

@staticmethod
Expand All @@ -76,4 +71,4 @@ def get_hostname_ip(debug: bool = False) -> tuple:
hostname_ip = GetHostname()
return hostname_ip.get_hostname(), hostname_ip.get_ip()
except Exception as ex:
logger.raise_fatal(BaseException(f'Error occurred: {ex}'))
logger.raise_fatal(BaseException(f"Error occurred: {ex}"))
Loading

0 comments on commit 96e96fe

Please sign in to comment.