minor additions
This commit is contained in:
@@ -530,7 +530,7 @@ if __name__ == '__main__':
|
|||||||
description='Dump a git repository from a website.')
|
description='Dump a git repository from a website.')
|
||||||
parser.add_argument('url', metavar='URL',
|
parser.add_argument('url', metavar='URL',
|
||||||
help='url')
|
help='url')
|
||||||
parser.add_argument('directory', metavar='DIR',
|
parser.add_argument('--directory', metavar='DIR', default=None, type=str,
|
||||||
help='output directory')
|
help='output directory')
|
||||||
parser.add_argument('--proxy',
|
parser.add_argument('--proxy',
|
||||||
help='use the specified proxy')
|
help='use the specified proxy')
|
||||||
@@ -577,6 +577,13 @@ if __name__ == '__main__':
|
|||||||
parser.error('invalid proxy')
|
parser.error('invalid proxy')
|
||||||
|
|
||||||
# output directory
|
# output directory
|
||||||
|
if args.directory is None:
|
||||||
|
parsed_url = urllib.parse.urlparse(args.url)
|
||||||
|
if not parsed_url or not parsed_url.hostname:
|
||||||
|
parser.error('no output directory given and cannot derive from URL')
|
||||||
|
else:
|
||||||
|
args.directory = parsed_url.hostname
|
||||||
|
|
||||||
if not os.path.exists(args.directory):
|
if not os.path.exists(args.directory):
|
||||||
os.makedirs(args.directory)
|
os.makedirs(args.directory)
|
||||||
|
|
||||||
|
|||||||
5
sqli.py
5
sqli.py
@@ -5,12 +5,13 @@ import string
|
|||||||
class SQLi(ABC):
|
class SQLi(ABC):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def build_query(column: str|list, table=None, condition=None, offset=None):
|
def build_query(column: str|list, table=None, condition=None, offset=None, limit=1):
|
||||||
column = column if isinstance(column, str) else ",".join(column)
|
column = column if isinstance(column, str) else ",".join(column)
|
||||||
condition = "" if not condition else f" WHERE {condition}"
|
condition = "" if not condition else f" WHERE {condition}"
|
||||||
offset = "" if offset is None else f" OFFSET {offset}"
|
offset = "" if offset is None else f" OFFSET {offset}"
|
||||||
table = "" if not table else f" FROM {table}"
|
table = "" if not table else f" FROM {table}"
|
||||||
return f"SELECT {column}{table}{condition} LIMIT 1{offset}"
|
limit = "" if limit is None else f" LIMIT {limit}"
|
||||||
|
return f"SELECT {column}{table}{condition}{limit}{offset}"
|
||||||
|
|
||||||
def extract_multiple_ints(self, column: str, table=None, condition=None, verbose=False):
|
def extract_multiple_ints(self, column: str, table=None, condition=None, verbose=False):
|
||||||
row_count = self.extract_int(f"COUNT({column})", table=table, condition=condition, verbose=verbose)
|
row_count = self.extract_int(f"COUNT({column})", table=table, condition=condition, verbose=verbose)
|
||||||
|
|||||||
Reference in New Issue
Block a user