Skip to content

Commit

Permalink
Relase 3.3.0
Browse files Browse the repository at this point in the history
This is a huge release, mostly because I got lazy in push these fixes.

Added Disabled Chunked Encoding to Proxmox
Added install method 2
Further fixes to proxmox error handling
Refactor proxmox createvm networking portion
Refactoring _proxmox_check
Refactoring _proxmox_check take two (non-bash
Set proxmox createvm -name as a requirement
Small fix to software_aws-cli
Small fixes to screen-sessions
Updated gcldupe to fix spacing issue
Updated netdata.md
Updated proxmox createvm error handling and debug for dhcp-net
chore(git): Comments
docs(aws): Added common aws-cli commands
docs(cloudways): Added cloudways wp-salt.php
docs(cloudways): Added documentation on how to use cloudways
docs(cryptomator): Added cryptomator.md
docs(cyberpanel): Added doc about ssl not renewing
docs(cyberpanel): Added email debug enablement
docs(cyberpanel): Updated list of logs.
docs(docker): Added information about running out of diskspace
docs(duplicacy): Updated doc with proper commands to delete fossil files.
docs(enhance): Added command to switch webserver which also rebuilds docker container.
docs(enhance): Added details about symlinking /var/run/mysqld/mysqld.sock
docs(enhance): Added documentation for enhance
docs(enhance): How to rebuild docker container and install php-cli so wp-cli works as root
docs(enhance): Typically mysql-slow.log is used versus slow-query.log
docs(enhance): Updated enhance doc with notes.
docs(enhance): Updated enhance for mysql, docker and logrotation
docs(enhance): Updated log rotation for mysql.
docs(github): Re-organized and added 'gh repo view --web'
docs(gridpane): Added command to disable xmlrpc.ph
docs(gridpane): Documented Nginx Rate Limiting for GridPane.
docs(gridpane): More documentation of GridPane nginx limiting
docs(gridpane): Put int SSL log paths
docs(kb): Added fail2ban kb article.
docs(kb): Updated cryptomator to include installing cli version
docs(linux): Added details about Linux shell redirection.
docs(mysql): Added details about column statistics and mariadb
docs(netdata): Added uinstall everything netdata command
docs(netdata): Updated alternative location for netdata install
docs(nginx): Added default setup of Nginx for PHP/MySQL
docs(node): Updated nodejs.md doc
docs(npm): Added more details to npm kb and kb description
docs(php): Added PHP error logging defaults
docs(php): Added zend_mm_heap corrupted to php.md
docs(powershell): Added details about exporting teams chat
docs(proxmox): Added Block 8006 and Forward to CF Host
docs(proxmox): Typo in proxmox.md
docs(python): Created python.md and added requirements.txt generation
docs(python): Updated pyhton kb to include more details about requirements.txt
docs(ubiquiti): Added opening up icmp on udm-pro
docs(ubuntu): Instructions on setting up unattended updates
docs(vscode): Added as section about setting up vscode with WSL for Remote SSH
docs(vscode): Added terminal copy on select configuration
docs(wordpress): Added PHP code to change admin email without confirmation
docs(zsh): Added "failed to load module: zsh/regex" for zsh docs
docs(zsh): Added in Troubleshooting and Hour Wasting Errors section.
docs(zsh): Added romkatv statically complied.
docs(zsh): Updated zsh to document zsh compinit: insecure directories
docs(zshbop): Documented how to develop ;)
docs: Updated litespeed.md with script to setup xdebug
enhance(glow): Updated glow binaries to 1.5.1
enhance(http-errorcodes): Added Cloudflare specific error codes
enhance(install): Updated zsh install to improve zsh install
enhance(raid): Updated software-raid-check output
enhance(software): Added fzf to software ommand
enhance(ssh): Updated pk to use fzf
enhance(wordpress): Added wordpress transient commands
feat(checks): Added docker checks including installed and errors
feat(cmds): Added find-empty-dirs to cmds
feat(core): Added set_rlimit.c for testing setrlimit
feat(core): Created _seconds_to_human
feat(cpu-features): Created cpu-features command
feat(cve): Added cve-2024-6387 scanner tool from https://github.com/xaitax/CVE-2024-6387_Check
feat(domain): Created domain-dmarc
feat(encryption): Added encryption commands for cryptomator
feat(file): Created findw for keyword finds
feat(github): Added gh-web function as short for gh repo view --web
feat(ip): Created ip-info using ipinfo.io
feat(linux): Added catvet and view-std commands
feat(linux): Added linux command to print latest debian and ubuntu versions
feat(linux): Added memory commands sum-mem
feat(linux): Added syss shortcut
feat(linux): Adedd geekbench-run-oneliner
feat(linux): Created compress command
feat(linux): Created last-boots.
feat(linux): Created lsof-mem to track process memory
feat(linux): swappiness-set
feat(mysql): Created mysql performance commands
feat(mysql): Created mysql-backup-mydumper
feat(os): Added install date to os command
feat(proxmox): Lots of changes to proxmox for createvm
feat(python): Created cmds-python.zsh and python-clean command
feat(redis): Created redis-pass
feat(software): Added gcloud install.
feat(software): Added installation for fpart to software
feat(software): Created detection of installation and proper setting of $ZSHBOP_SOFTWARE_PATH
feat(ssh): Created ssh-config command to print out ssh config
feat(ssh): Created ssh-password function to force password authentication
feat(ssh): Created ssh-remove-kh
feat(ssl): Added -ip to ssl-check
feat(swap-reset): Created swap-reset to clear swap.
feat(web): Created http-errorcodes to list and search http error codes
feat(wordpress): Added wp-domain as a command
feat(wordpress): Created _wp_installed and wp-user-count
feat(wordpress): Created wp-plugin-install
feat(zshbop): Added zsh completion for zb and zshbop commands
feat(zshbop): Added zshbop command plugins
fix(antigen): Removed NVM, on default installs it's heavy
fix(cf-check): Small fixes
fix(checks): Improved docker check for error
fix(checks): Updated checks to log if not important.
fix(cmds): Mismatched naming for cmds-file.zsh
fix(core): Added joe-wrapper for EDITOR use
fix(core): Added less to zshbop help
fix(core): Compacting motd
fix(core): Compiled set_rlimit for linux and set execute bit
fix(core): Don't override date, it's silly, do date-more
fix(core): Fixed OS detection for WSL
fix(core): Fixed core mac os detection for grepcidr3
fix(core): Fixed detection of logging directory.
fix(core): Fixed detection of mac grepcidr3
fix(core): Fixed docker check to filter error to /dev/null
fix(core): Fixed some strange alias overlap
fix(core): Fixed the formatting of motd
fix(core): Fixed zshbop cleanup
fix(core): Fixed zshbop report
fix(core): Fixed zshbop report to be able to run from zshbo_report with arguments
fix(core): Fixed zshbop_reload quick reload.
fix(core): Fixed zshbop_reload to use proper path for reloading specific cmd file
fix(core): Implementing error checking for zshbop updating
fix(core): Load cmds-software.zsh first by renaming to cmds-0-software.zsh
fix(core): Load zshbop_custom-load before init_plugins
fix(core): Reducing output on start of zshbop
fix(core): Removed date from overrides
fix(core): Renamed init_cmds to init_zbr_cmds
fix(core): Rewrote _marray into _inarray
fix(core): Type in help_int
fix(core): Type with setting $ZSHBOP_HOME
fix(cpu): Fixed cpu and cpu-features
fix(cpu-features): Fixed typo for success
fix(docker): Moved dops alias to function
fix(docker): Small fix to dps to remove omz alias
fix(docker): Updated docker commands to use docker compose versus docker-compose
fix(domain): Fixed domain-info showing mx records.
fix(domains): Updated dom to strip http(s)://
fix(gc): Changed back gc to git + commit and added glc
fix(git): Fixed git-check and created git-repos-updates
fix(git): Updated gbl to use --no-pager
fix(glint): Added group permission for glint
fix(gridpane): Removing more GridPane items
fix(init): Added synology to os type to load linux os cmds
fix(init): Ensure vm-check-detect is run on init after name change
fix(init): Fixed init_detect_install_type typo
fix(init): Moved detect-os to top of init
fix(install): Another fix for install and OS detection
fix(install): Check if zsh is at least 5.8
fix(install): Don't continue unless choise is valid for zsh install
fix(install): Fix install to apt-get update before installing packages
fix(install): Fixed install os detect, fires later
fix(install): Fixed typo in install
fix(install): Removed lynx, not required.
fix(install): Small fix for checking if we can write to $HOME
fix(install): Updated install.sh to use custom dir and confirm writing to choosen installation directory
fix(isntall): Added OS detection and added ucommon-utils
fix(joe): Fixed how joe configuration is setup
fix(kb): Added debug to kb command
fix(linux): Added snapfuse to exclude for check_diskspace_linux
fix(linux): Excluded sit interface from _interfaces_linux
fix(linux): Fixed exa command to show groups
fix(linux): Improved check-diskspace
fix(linux): Updated os command and get-os-install date
fix(logging): Rewrote some logging functions
fix(mac): Fixed exa detection.
fix(mac): Interface listing was resulting in error if interface didn't exist, piped error to /dev/null
fix(mac): Updated os-mac.zsh to have a help file
fix(mysql): Actually fix mysql-backupdb function ;)
fix(mysql): Changed mysql-backupdb to mysql-backup-db
fix(mysql): Don't use ~ instead use $HOME
fix(mysql): Removed command that should be paid.
fix(mysql): Renamed mysqlps to mysql-ps
fix(ncdu): Fixed install alias for ncdu
fix(netdata): Updated netdata documentation to new url and improved formatting
fix(network): Fixed type
fix(network): Updated interfaces command to use _interfaces_linux as it's an internal command
fix(network): Updated network-ports to support mawk versus awk
fix(os): Fixed detection of macos intel vs arm
fix(os): Fixed joe ftyperc
fix(plik): Added mac plik cli binary and fixed plik os-binary detection
fix(proxmox): Added apt-get install libguestfs-tools to proxmox
fix(proxmox): Adding in proper error handling
fix(proxmox): Fixed the proxmox disk default size to 20000
fix(proxmox): Issue with setting VM storage options.
fix(proxmox): Multiple fixes for the proxmox command
fix(proxmox): Removed --ci-custom
fix(proxmox): Set proper cicustom
fix(proxmox): Typo
fix(proxmox): Typo in proxmox command
fix(python): Fixed typo in cmds-python file extension
fix(redis): Fixed redis-info to get password.
fix(redis): Updated redis-info to not print out detailed information
fix(repos): Added repos branch command
fix(screen): Fixed issues with screen error messages.
fix(software): Added function for vt so it doesn't fail
fix(software): Fixed issues with glint detection
fix(software): Fixed php-install for Ubuntu Litespeed
fix(software): Fixed software command to detect if function exists
fix(software): Fixed software detection for glint
fix(software): Improved atop install and setup
fix(software): More fixes glint
fix(software): Small fixes to glint detection
fix(software): Updated disto release to stable for docker-ctop
fix(software): Updated gcloud to use MACHINE_OS_FLAVOUR properly
fix(ssh): Fixed pk fzf detection
fix(ssh): Fixed ssh-config-view
fix(ssh): Fixed ssho issues
fix(ssh): Fixed variable typo
fix(ssh): Renamed help for ssho as it wasn't descriptive.
fix(system): Updated find-swap to swap-find and swappiness
fix(vm-check-detect): Fixed vm-check-detect to be case insensitive
fix(wordpress): Small improvements to wp-backupsite
fix(wordpress): Updated wp-plugin-install command
fix(zshbop): EDITOR is now joe-wrapper Updated os-binary to remove debug and add debugf
fix(zshbop): Fixed more typos
fix(zshbop): Fixed typo's in .zshbop.conf.example Added antigen plugin additions section
fix: Better messaging for software_glint
fix: Small fixes
improvement(cloudflare): Created cf-cloudflare-fixes to address udp quic systemctl settings
improvement(cloudflare): Impoved cf-check
improvement(core): Addded _loading2b as an alterantive.
improvement(core): Added LC_TIME and removed LC_ALL to default to system
improvement(core): Added docker to init_check_services
improvement(core): Added function-overrides.zsh and overidding date
improvement(core): Added some easy to use colors _green
improvement(core): Check for custom services check zb_init_check_services_custom
improvement(core): Cleaned up environment variables
improvement(core): Fixed _seconds_to_human to not print 0
improvement(core): Improved init by creating init_dirs as separate function
improvement(core): Improved loading WSL specific commands and windows terminal backup
improvement(core): Improved tzc
improvement(core): Logged all init commands that run and by order.
improvement(core): Major changes to loading of commands Updated os install detection
improvement(core): Moved date-more to cmds-linux.zsh
improvement(core): Sorting out code :)
improvement(core): Started using $ZSHBOP_HOME instead of $HOME if $HOME isn't writable
improvement(core): Updated docker check
improvement(core): Updated zshbop_reload to reload specific cmds-* files
improvement(core/screen): Improved core with loading3b for no *** Improved printing of screen-sessions on load
improvement(cpu): Updated cpu-features command to notify on vm
improvement(cpu-features): Updated cpu-features to work with lscpu and /proc/cpuinfo
improvement(cpu-features): Updated cpu-feauters to add more information.
improvement(domain): Added in domain-info from /bin and created domain-spf
improvement(domain): Strip emails when entered into dom command.
improvement(domain): Upadted dom and domain command
improvement(domain): Updated dom and domain with better details.
improvement(domain): Updated dom to comma www and apex lookups between multiple IP's
improvement(domains): Updated domain command to include expiry, and created date
improvement(domains): Updated domains file to better format
improvement(encryption): Improved cryptomator commands and combined into cryptomator command
improvement(file): Updated findw to findk and improved it's output
improvement(git): Improved git branching aliases
improvement(git): Updated git-check to respond to -h
improvement(gridpane): More removal of GridPane code.
improvement(help): Improved help command
improvement(help): More small fixes to help, including searching
improvement(http): Changed http-error-codes to http-status-codes
improvement(install): Groundwork for zsh binary install
improvement(install): Improved code for install and added search
improvement(install): Improved install script
improvement(install): Major improvement to install.sh to run in locked down environments
improvement(install): Updated apt-get install with -y to skip missing packages
improvement(install): Updated installed to check zsh is in path
improvement(ip): Added ip-scam and fixed name of variables for ip-info
improvement(ip): Updated ip-info logic and messaging
improvement(kb): Improved KB functions.
improvement(kb): Improving KB functions.
improvement(kb): More refactoring kb.zsh
improvement(kb): Revamped KB
improvement(mac): Updated flush-dns to mac-flush-dns
improvement(mysql): Improved mysql-backup-mydumper
improvement(mysql): Improved output of mysql-backup-mydumper
improvement(mysql): Updated mysqltuner.pl to 2.6.0
improvement(network): Added network-ports command and updated linux.md
improvement(network): Added placeholder for dhcp-lease-list cmd
improvement(os): Updated os command to include VM_TYPE
improvement(p10k): Added in OS version on command line
improvement(proxmox): Added -cpu to provide how many cores for vm creation
improvement(proxmox): Defaulted to jammy from focal
improvement(screen): Listing screen session in a better format
improvement(software): Added zsh completion to software command and improved crytomator-cli
improvement(ssh): Improved pk and ssho command
improvement(ssh): Improved ssho command.
improvement(vm-check-detect): Improved vm-check-detect
improvement(wordpres): Improved wp-admin-email
improvement: Updated _cexists to _cmd_exists Updated get-os-install-date function
refactor(cf-check): Major refactor of cf-check
refactor(check-ssl): Refactored check-ssl
refactor(cloudflare): Refactored some cloudlfare commands and fixed cloudflare typo
refactor(core): Added init_kb
refactor(core): Refactored what's printed out on startup
refactor(core): Refactoring internal functions to use help_inc
refactor(core): Removing more motd for gridpane and runcloud to be put into lmc
refactor(domain): Refactored some domain commands
refactor(glint): Refactored the detection and install of glint
refactor(gridpane): Removed gridpane and move to private repo
refactor(install): Did some refactoring of the install file
refactor(mysql): Updated and renamed mysql-dbsizeall and create mysql-dbsize
refactor(proxmox): Refactored _proxmox_check
refactor(softare): Refactored the software system and zbr
refactor(software): Refactored the software command.
refactor(ssh): Refactored pk command
refactor(wordpress): Removed _wp_install versus _wp-install-check
refactor(wsl): Refactored os-wsl.zsh
refactor(zshbop): Refactored zshbop init.zsh
  • Loading branch information
jordantrizz committed Sep 11, 2024
1 parent f4ca764 commit 7f63bdb
Show file tree
Hide file tree
Showing 104 changed files with 6,778 additions and 2,063 deletions.
6 changes: 3 additions & 3 deletions .antigenrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle command-not-found
antigen bundle desyncr/auto-ls
antigen bundle zsh-users/zsh-autosuggestions
export NVM_COMPLETION=true
antigen bundle lukechilds/zsh-nvm
#export NVM_COMPLETION=true
#antigen bundle lukechilds/zsh-nvm

#antigen bundle djui/alias-tips # Disabled for now, requires python
#antigen bundle viasite-ansible/zsh-ansible-server
#antigen bundle zpm-zsh/mysql-colorize

####-- Load FZF
if _cexists fzf; then
if _cmd_exists fzf; then
_debug "fzf is installed"
antigen bundle andrewferrier/fzf-z
antigen bundle wfxr/forgit
Expand Down
11 changes: 10 additions & 1 deletion .p10k.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@
# The list of segments shown on the left. Fill it with the most important segments.
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
# =========================[ Line #1 ]=========================
os_icon # os identifier
os_icon # os identifier
my_os_version # os version
context # user@hostname
dir # current directory
vcs # git status
root_indicator # An indicator if the user has superuser status.

# =========================[ Line #2 ]=========================
newline
prompt_char # prompt symbol
Expand Down Expand Up @@ -104,6 +106,7 @@
# proxy # system-wide http/https/ftp proxy
battery # internal battery
# example # example user-defined segment (see prompt_example function below)
os_version
)

# Set IP interface
Expand Down Expand Up @@ -1188,3 +1191,9 @@

(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
'builtin' 'unset' 'p10k_config_opts'

# -- Print the os version number
function prompt_my_os_version () {
p10k segment -b 1 -f 3 -t "${MACHINE_OS_VERSION}"
}
POWERLEVEL9K_MY_OS_VERSION_FOREGROUND=208
13 changes: 10 additions & 3 deletions .zshbop.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -- Example .zshbop.conf
# * Override zshbop functions, settings and variables
# * Create own custom functions, variables and zsh scripts
# * Move to $HOME/.zshbop.custom and uncomment as needed
# * Move to $HOME/.zshbop.conf and uncomment as needed
# =================================================================================================

# =================================================================================================
Expand All @@ -16,7 +16,9 @@
#export GIT_HOME="$HOME/git" # -- A location where you have all your git repositories.
#ZSHBOP_UPDATE_GIT=(${HOME}/git/cloudflare-cli ${GIT_HOME}/plik) # -- Git Repositores to update when running zshbop update
#export -p ZSHBOP_UPDATE_GIT > /dev/null

#export ZSHBOP_IP_PROVIDER="ipinfo.io"
#export ZSHBOP_IP_API_KEY=""
#export ZSHBOP_IP_SCAM="" # API key for scamalytics.com

# =================================================================================================
# -- Application settings
Expand Down Expand Up @@ -46,6 +48,11 @@
#
#}

# =================================================================================================
# -- Additional omz plugins
# =================================================================================================
#plugins+=('universalarchive')

# =================================================================================================
# -- Custom zshbop directory
# * Setup custom directory for scripts and other configuration, source any files you require.
Expand All @@ -61,6 +68,6 @@
# =================================================================================================

_debug "###########################################################"
_debug "################ Loading .zshbop.custom ###################"
_debug "################ Loading .zshbop.conf ###################"
_debug "###########################################################"

16 changes: 16 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Development
This is mostly for myself, but if someone else want's to contribute then this is a good place to start.

# Debugging
# Debug
Partialy implemented, but needs to be improved.
## Debugging Functions
You can use the function zbdebug on the cli and _debugf within any function to print out debug information.

```
zbdebug os-binary
** [DEBUG]: No binary specified
```

The function os-binary has a _debugf "No binary specified" which is printed out when zbdebug is called with the argument os-binary.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ Copy ```.zshbop.config.example``` to ```$HOME/.zshbop.config``` and modify as ne
| `ZSHBOP_GIT_CHECK` | zshbop git check on logout, this will run and will $GIT_HOME for any repositories that have uncommited code. | Number | 1 |
| `GIT_HOME` | A location where you have all your git repositories. | String | $HOME/git |
| `ZSHBOP_UPDATE_GIT` | Git Repositores to update when running zshbop update | Array | ${HOME}/git/cloudflare-cli ${GIT_HOME}/plik |
| `ZSH_IP_PROVIDER` | IP Provider for zshbop | String | eg. ipinfo.io |
| `ZSH_IP_API_KEY` | API Key for ip-info commmand | String | |

### Exbin
* Exbin https://exbin.call-cc.be
Expand Down
228 changes: 228 additions & 0 deletions bin/CVE-2024-6387_Check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
#!/usr/bin/env python3

import socket
import argparse
import ipaddress
import threading
import time
from queue import Queue
from concurrent.futures import ThreadPoolExecutor

VERSION = "0.5"

BLUE = "\033[94m"
GREEN = "\033[92m"
RED = "\033[91m"
ORANGE = "\033[33m"
ENDC = "\033[0m"

progress_lock = threading.Lock()
progress_counter = 0
total_hosts = 0


def display_banner():
banner = rf"""
{BLUE}
_________ _________ ___ ___ .__
_______ ____ ___________ ____ / _____// _____// | \|__| ____ ____
\_ __ \_/ __ \ / ___\_ __ \_/ __ \ \_____ \ \_____ \/ ~ \ |/ _ \ / \
| | \/\ ___// /_/ > | \/\ ___/ / \/ \ Y / ( <_> ) | \
|__| \___ >___ /|__| \___ >_______ /_______ /\___|_ /|__|\____/|___| /
\/_____/ \/ \/ \/ \/ \/
CVE-2024-6387 Vulnerability Checker
v{VERSION} / Alex Hagenah / @xaitax / [email protected]
{ENDC}
"""
print(banner)


def get_ssh_sock(ip, port, timeout):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(timeout)
try:
sock.connect((ip, port))
return sock
except:
sock.close()
return None


def get_ssh_banner(sock):
try:
banner = sock.recv(1024).decode(errors='ignore').strip()
sock.close()
return banner
except Exception as e:
return str(e)


def check_vulnerability(ip, port, timeout, result_queue):
global progress_counter

sshsock = get_ssh_sock(ip, port, timeout)
if not sshsock:
result_queue.put((ip, port, 'closed', "Port closed"))
with progress_lock:
progress_counter += 1
return

banner = get_ssh_banner(sshsock)
if "SSH-2.0" not in banner:
result_queue.put(
(ip, port, 'failed', f"Failed to retrieve SSH banner: {banner}"))
with progress_lock:
progress_counter += 1
return

if "SSH-2.0-OpenSSH" not in banner:
result_queue.put((ip, port, 'unknown', f"(banner: {banner})"))
with progress_lock:
progress_counter += 1
return

vulnerable_versions = [
'SSH-2.0-OpenSSH_1',
'SSH-2.0-OpenSSH_2',
'SSH-2.0-OpenSSH_3',
'SSH-2.0-OpenSSH_4.0',
'SSH-2.0-OpenSSH_4.1',
'SSH-2.0-OpenSSH_4.2',
'SSH-2.0-OpenSSH_4.3',
'SSH-2.0-OpenSSH_4.4',
'SSH-2.0-OpenSSH_8.5',
'SSH-2.0-OpenSSH_8.6',
'SSH-2.0-OpenSSH_8.7',
'SSH-2.0-OpenSSH_8.8',
'SSH-2.0-OpenSSH_8.9',
'SSH-2.0-OpenSSH_9.0',
'SSH-2.0-OpenSSH_9.1',
'SSH-2.0-OpenSSH_9.2',
'SSH-2.0-OpenSSH_9.3',
'SSH-2.0-OpenSSH_9.4',
'SSH-2.0-OpenSSH_9.5',
'SSH-2.0-OpenSSH_9.6',
'SSH-2.0-OpenSSH_9.7'
]

excluded_versions = [
'SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.10',
'SSH-2.0-OpenSSH_9.3p1 Ubuntu-3ubuntu3.6',
'SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.3',
'SSH-2.0-OpenSSH_9.3p1 Ubuntu-1ubuntu3.6',
'SSH-2.0-OpenSSH_9.2p1 Debian-2+deb12u3',
'SSH-2.0-OpenSSH_8.4p1 Debian-5+deb11u3'
]

if any(version in banner for version in vulnerable_versions) and banner not in excluded_versions:
result_queue.put((ip, port, 'vulnerable', f"(running {banner})"))
else:
result_queue.put((ip, port, 'not_vulnerable', f"(running {banner})"))

with progress_lock:
progress_counter += 1


def process_ip_list(ip_list_file):
ips = []
try:
with open(ip_list_file, 'r') as file:
ips.extend(file.readlines())
except IOError:
print(f"❌ [-] Could not read file: {ip_list_file}")
return [ip.strip() for ip in ips]


def main():
global total_hosts
display_banner()

parser = argparse.ArgumentParser(
description="Check if servers are running a vulnerable version of OpenSSH (CVE-2024-6387).")
parser.add_argument(
"targets", nargs='*', help="IP addresses, domain names, file paths containing IP addresses, or CIDR network ranges.")
parser.add_argument("--port", type=int, default=22,
help="Port number to check (default: 22).")
parser.add_argument("-t", "--timeout", type=float, default=1.0,
help="Connection timeout in seconds (default: 1 second).")
parser.add_argument(
"-l", "--list", help="File containing a list of IP addresses to check.")

args = parser.parse_args()
targets = args.targets
port = args.port
timeout = args.timeout

ips = []

if args.list:
ips.extend(process_ip_list(args.list))

for target in targets:
try:
with open(target, 'r') as file:
ips.extend(file.readlines())
except IOError:
if '/' in target:
try:
network = ipaddress.ip_network(target, strict=False)
ips.extend([str(ip) for ip in network.hosts()])
except ValueError:
print(f"❌ [-] Invalid CIDR notation: {target}")
else:
ips.append(target)

result_queue = Queue()

total_hosts = len(ips)

max_workers = 100

with ThreadPoolExecutor(max_workers=max_workers) as executor:
futures = [executor.submit(check_vulnerability, ip.strip(
), port, timeout, result_queue) for ip in ips]

while any(future.running() for future in futures):
with progress_lock:
print(f"\rProgress: {progress_counter}/{total_hosts} hosts scanned", end="")
time.sleep(1)

for future in futures:
future.result()

print(f"\rProgress: {progress_counter}/{total_hosts} hosts scanned")

total_scanned = len(ips)
closed_ports = 0
unknown = []
not_vulnerable = []
vulnerable = []

while not result_queue.empty():
ip, port, status, message = result_queue.get()
if status == 'closed':
closed_ports += 1
elif status == 'unknown':
unknown.append((ip, message))
elif status == 'vulnerable':
vulnerable.append((ip, message))
elif status == 'not_vulnerable':
not_vulnerable.append((ip, message))
else:
print(f"⚠️ [!] Server at {ip}:{port} is {message}")

print(f"\n🛡️ Servers not vulnerable: {len(not_vulnerable)}\n")
for ip, msg in not_vulnerable:
print(f" [+] Server at {GREEN}{ip}{ENDC} {msg}")
print(f"\n🚨 Servers likely vulnerable: {len(vulnerable)}\n")
for ip, msg in vulnerable:
print(f" [+] Server at {RED}{ip}{ENDC} {msg}")
print(f"\n⚠️ Servers with unknown SSH version: {len(unknown)}\n")
for ip, msg in unknown:
print(f" [+] Server at {ORANGE}{ip}{ENDC} {msg}")
print(f"\n🔒 Servers with port {port} closed: {closed_ports}")
print(f"\n📊 Total scanned targets: {total_scanned}\n")


if __name__ == "__main__":
main()
Loading

0 comments on commit 7f63bdb

Please sign in to comment.