Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ _Don't forget to patch `./lib/main.py` to point to the new binary_!
- **-o**: `</path/to/file>` to store the successfully attempt(s) (default is `./crowbar.out`)
- **-p**: Port number (if the service is not on the default port)
- **-q**: Enable quiet mode (only show successful logins)
- **-s**: Target IP address/range (in CIDR notation)
- **-S**: `</path/to/file>` which is stores target IP addresses
- **-s**: Target IP address/range
- **-S**: `</path/to/file>` File containing target IP addresses/ranges
- **-t**: Timeout value
- **-u**: Single username
- **-U**: `</path/to/file>` which stores the username list
Expand Down
2 changes: 2 additions & 0 deletions lib/core/common.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
class bcolors:
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
FAIL = '\033[91m'
ENDC = '\033[0m'

def disable(self):
self.OKBLUE = ''
self.OKGREEN = ''
self.FAIL = ''
self.ENDC = ''
4 changes: 4 additions & 0 deletions lib/core/iprange.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ def binary_to_ipaddr(self, ipbinary):
return socket.inet_ntoa(struct.pack('!I', ipbinary))

def iprange(self, ipaddr):
single_re = re.compile(r"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$", re.VERBOSE) # IP address without CIDR notation
res = single_re.match(ipaddr)
if res:
return [ipaddr.strip()]
span_re = re.compile(r'''(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) # The beginning IP address
\s*-\s*
(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) # The end IP address
Expand Down
2 changes: 1 addition & 1 deletion lib/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def __init__(self):
mess = "File: %s cannot be opened" % os.path.abspath(self.args.server_file)
raise CrowbarExceptions(mess)
except:
mess = "Invalid IP Address! Please use IP/CIDR notation <192.168.37.37/32, 192.168.1.0/24>"
mess = "Invalid IP Address! " + bcolors.FAIL + str(_) + bcolors.ENDC + "Please use valid IP/CIDR notation <192.168.43.56, 192.168.37.37/32, 192.168.1.0/24>"
raise CrowbarExceptions(mess)

if self.args.verbose:
Expand Down