Projects STRLCPY ghauri Commits 8f5309e4
🤬
  • fixed #41, updated code for when user want to skip testing injection market and continue testing the target normally..

  • Loading...
  • r0oth3x49 committed 1 year ago
    8f5309e4
    1 parent 8afc6b3f
  • ■ ■ ■ ■ ■ ■
    ghauri/common/lib.py
    skipped 286 lines
    287 287  UPDATE storage set value=? WHERE id=? AND type=?;
    288 288  """
    289 289   
     290 +AVOID_PARAMS = [
     291 + "__ASYNCPOST",
     292 + "__LASTFOCUS",
     293 + "__EVENTTARGET",
     294 + "__EVENTARGUMENT",
     295 + "__VIEWSTATE",
     296 + "__VIEWSTATEGENERATOR",
     297 + "__VIEWSTATEENCRYPTED",
     298 + "__EVENTVALIDATION",
     299 + "__RequestVerificationToken",
     300 + "_dc",
     301 + "SAMLResponse",
     302 + "RelayState",
     303 + "__SCROLLPOSITIONY",
     304 + "__SCROLLPOSITIONX",
     305 + "__RequestVerificationToken",
     306 +]
     307 + 
  • ■ ■ ■ ■ ■ ■
    ghauri/common/utils.py
    skipped 50 lines
    51 51   BaseHTTPRequestHandler,
    52 52   INJECTABLE_HEADERS_DEFAULT,
    53 53   HTTP_STATUS_CODES_REASONS,
     54 + AVOID_PARAMS,
    54 55  )
    55 56  from ghauri.common.config import conf
    56 57  from ghauri.common.payloads import PAYLOADS
    skipped 3 lines
    60 61   
    61 62  class Struct:
    62 63   def __init__(self, **entries):
     64 + self.__key = entries.get("key")
     65 + self.__value = entries.get("value")
    63 66   self.__dict__.update(entries)
     67 + 
     68 + def __repr__(self):
     69 + return f"<Parameter('{self.__key}')>"
    64 70   
    65 71   
    66 72  # source: https://stackoverflow.com/questions/4685217/parse-raw-http-headers
    skipped 1491 lines
    1558 1564   _ = []
    1559 1565   for entry in _params:
    1560 1566   p = Struct(**entry)
     1567 + if p.key in AVOID_PARAMS:
     1568 + continue
    1561 1569   _.append(p)
    1562 1570   injection_point.update({_type: _})
    1563 1571   _temp = InjectionPoints(
    skipped 342 lines
    1906 1914   _temp = []
    1907 1915   for entry in records:
    1908 1916   parameter = json.loads(entry.parameter)
     1917 + if "parameter_type" not in parameter:
     1918 + logger.warning(
     1919 + "You are using an old version of Ghauri, Update to the latest version and re-run with switch `--flush-session`.."
     1920 + )
     1921 + logger.end("ending")
     1922 + exit(0)
    1909 1923   parameter = Struct(**parameter)
    1910 1924   if parameter.key not in seen:
    1911 1925   seen.add(parameter.key)
    skipped 119 lines
  • ■ ■ ■ ■
    ghauri/core/tests.py
    skipped 420 lines
    421 421   logger.warning("user aborted during boolean-based confirmation phase")
    422 422   break
    423 423   except Exception as error:
    424  - logger.critical(f"error {error}, during time-based confirmation phase.")
     424 + logger.critical(f"error {error}, during boolean-based confirmation phase.")
    425 425   break
    426 426   attempts_count = len(_temp)
    427 427   total_attempts_to_vulnerable = len(test_payloads)
    skipped 2101 lines
  • ■ ■ ■ ■ ■ ■
    ghauri/ghauri.py
    skipped 170 lines
    171 171   url=url, data=data, headers=full_headers, cookies=raw_cookies
    172 172   )
    173 173   custom_injection_in = obj.custom_injection_in
    174  - if "COOKIE" in custom_injection_in:
    175  - level = 2
    176  - if "HEADER" in custom_injection_in:
    177  - level = 3
    178 174   injection_points = obj.injection_point
    179 175   conf.is_multipart = is_multipart = obj.is_multipart
    180 176   conf.is_json = is_json = obj.is_json
    skipped 27 lines
    208 204   exit(0)
    209 205   for injection_type in list(injection_points.keys()):
    210 206   if custom_injection_in:
    211  - question = "y"
     207 + if "COOKIE" in custom_injection_in:
     208 + level = 2
     209 + if "HEADER" in custom_injection_in:
     210 + level = 3
     211 + question = None
    212 212   if "POST" in custom_injection_in:
    213 213   if not is_asked:
    214 214   question = logger.read_input(
    skipped 20 lines
    235 235   is_asked = True
    236 236   if question and question == "y":
    237 237   injection_types = custom_injection_in
     238 + if question and question == "n":
     239 + # when custom injection marker '*' is found but user don't want to scan those we will go with default level 1
     240 + level = 1
     241 + custom_injection_in = []
    238 242   if level == 1 and not injection_types:
    239 243   injection_types = ["GET", "POST"]
    240 244   if level == 2 and not injection_types:
    skipped 572 lines
Please wait...
Page is in error, reload to recover