Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No OSID header detected, exiting - while trying to login #473

Open
ranlo opened this issue Nov 30, 2023 · 1 comment
Open

No OSID header detected, exiting - while trying to login #473

ranlo opened this issue Nov 30, 2023 · 1 comment

Comments

@ranlo
Copy link

ranlo commented Nov 30, 2023

Describe the bug
Getting an exception while trying to login

No OSID header detected, exiting

Traceback (most recent call last):
File "/Users/root/.local/bin/ghunt", line 8, in
sys.exit(main())
^^^^^^
File "/Users/root/.local/pipx/venvs/ghunt/lib/python3.11/site-packages/ghunt/ghunt.py", line 15, in main
parse_and_run()
File "/Users/root/.local/pipx/venvs/ghunt/lib/python3.11/site-packages/ghunt/cli.py", line 31, in parse_and_run
process_args(args)
File "/Users/root/.local/pipx/venvs/ghunt/lib/python3.11/site-packages/ghunt/cli.py", line 38, in process_args
trio.run(login.check_and_login, None, args.clean)
File "/Users/root/.local/pipx/venvs/ghunt/lib/python3.11/site-packages/trio/_core/_run.py", line 1946, in run
raise runner.main_task_outcome.error
File "/Users/root/.local/pipx/venvs/ghunt/lib/python3.11/site-packages/ghunt/modules/login.py", line 90, in check_and_login
ghunt_creds.osids = await gen_osids(cookies, osids)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/root/.local/pipx/venvs/ghunt/lib/python3.11/site-packages/ghunt/helpers/auth.py", line 92, in gen_osids
raise GHuntOSIDAuthError("[-] No OSID header detected, exiting...")

Screenshots
the call to console.cloud.google.com returns this

<title>Error 400 (Bad Request)!!1</title><style nonce="2EWP_kRKkAY-2t-uagH8YA">*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{color:#222;text-align:unset;margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px;}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}pre{white-space:pre-wrap;}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}</style>

400. That’s an error.

The server cannot process the request because it is malformed. It should not be retried. That’s all we know.

System (please complete the following information):

  • Monterey 12.2.1 (21D62)
  • Python 3.11.6

Additional context
Add any other context about the problem here.

@WhiteHatInspector
Copy link

WhiteHatInspector commented Apr 1, 2024

I also have a similar issue. I had this issue with both the previous version of GHunt but also the newest one.

Describe the bug
While running the code below in PyCharm, I get the error:
hunt.errors.GHuntOSIDAuthError: [-] No OSID header detected, exiting...

Code used:
import asyncio
import base64
from ghunt.helpers.utils import *
from ghunt.modules import login

async def main():
try:
print("hi2")
async with httpx.AsyncClient() as client:
await login.check_and_login(client, clean=False)
except Exception as e:
print(f"Error: {e}")

asyncio.run(main())

Screenshots/Code Output:
hi2
[-] No stored session found.

You can facilitate configuring GHunt by using the GHunt Companion extension on Firefox, Chrome, Edge and Opera here :
=> https://github.com/mxrch/ghunt_companion

[1] (Companion) Put GHunt on listening mode (currently not compatible with docker)
[2] (Companion) Paste base64-encoded authentication
[3] Enter the oauth_token (stats with "oauth2_4/")
[4] Enter the master token (starts with "aas_et/")
Choice => 2
Paste the encoded credentials here => {deducted_base64_cookies}

[+] Got OAuth2 token => oauth2_4/{deducted_oath_token}

[Connected account]
Name : {deducted_name}
Email : {deducted_email}

🔑 A master token has been generated for your account and saved in the
credentials file, please keep it safe as if it were your password, because it
gives access to a lot of Google services, and with that, your personal
information.
Master token services access : mail, hist, youtube, dynamite, local
Generating cookies and osids...

[+] New token for chrome has been generated
cookies in gen_cookies_and_osids: {
'SID': 'deducted',
'__Secure-1PSID': 'deducted',
'__Secure-3PSID': 'deducted',
'HSID': 'deducted',
'SSID': 'deducted',
'APISID': 'deducted',
'SAPISID': 'deducted',
'__Secure-1PAPISID': 'deducted',
'__Secure-3PAPISID': 'deducted',
'NID': 'deducted',
'LSID': 'deducted',
'__Host-1PLSID': 'deducted',
'__Host-3PLSID': 'deducted',
'ACCOUNT_CHOOSER': 'deducted',
'__Host-GAPS': 'deducted'
}
osids in gen_cookies_and_osids: ['cloudconsole', 'cl']
req text:
cookies: { 'SID': 'deducted', '__Secure-1PSID': 'deducted', '__Secure-3PSID': 'deducted', 'HSID': 'deducted', 'SSID': 'deducted', 'APISID': 'deducted', 'SAPISID': 'deducted', '__Secure-1PAPISID': 'deducted', '__Secure-3PAPISID': 'deducted', 'NID': 'deducted', 'LSID': 'deducted', '__Host-1PLSID': 'deducted', '__Host-3PLSID': 'deducted', 'ACCOUNT_CHOOSER': 'deducted', '__Host-GAPS': 'deducted' }

params: {}
req text:
cookies: { 'SID': 'deducted', '__Secure-1PSID': 'deducted', '__Secure-3PSID': 'deducted', 'HSID': 'deducted', 'SSID': 'deducted', 'APISID': 'deducted', 'SAPISID': 'deducted', '__Secure-1PAPISID': 'deducted', '__Secure-3PAPISID': 'deducted', 'NID': 'deducted', 'LSID': 'deducted', '__Host-1PLSID': 'deducted', '__Host-3PLSID': 'deducted', 'ACCOUNT_CHOOSER': 'deducted', '__Host-GAPS': 'deducted' }
params: {}
https://console.cloud.google.com/accounts/SetOSID
req text(osid): < h1 >Unauthorized
< h2 >Error 401

req.cookies: <Cookies[]>
Traceback (most recent call last):
File "C:\Users{deducted}\PycharmProjects{deducted_test_project}\new_effort.py", line 92, in
asyncio.run(main())
File "C:\Users{deducted}\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Users{deducted}\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users{deducted}\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users{deducted}\PycharmProjects{deducted_test_project}\new_effort.py", line 52, in main
await login.check_and_login(client, clean=False)
File "C:\Users{deducted}\PycharmProjects{deducted_test_project}{deducted_test_project}\Lib\site-packages\ghunt\modules\login.py", line 83, in check_and_login
await auth.gen_cookies_and_osids(as_client, ghunt_creds)
File "C:\Users{deducted}\PycharmProjects{deducted_test_project}{deducted_test_project}\Lib\site-packages\ghunt\helpers\auth.py", line 162, in gen_cookies_and_osids
osids = await gen_osids(as_client, cookies, osids)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users{deducted}\PycharmProjects{deducted_test_project}{deducted_test_project}\Lib\site-packages\ghunt\helpers\auth.py", line 104, in gen_osids
await asyncio.gather(*tasks)
File "C:\Users{deducted}\PycharmProjects{deducted_test_project}{deducted_test_project}\Lib\site-packages\ghunt\helpers\auth.py", line 93, in gen_osid
raise GHuntOSIDAuthError("[-] No OSID header detected, exiting...")
ghunt.errors.GHuntOSIDAuthError: [-] No OSID header detected, exiting...

Process finished with exit code 1

System (please complete the following information):

Windows 10
Python 3.11 (Pycharm environment)
ghunt 2.1.3

Additional context
Below outputs were inserted through code by me to see what is happening

cookies in gen_cookies_and_osids: {
'SID': 'deducted',
'__Secure-1PSID': 'deducted',
'__Secure-3PSID': 'deducted',
'HSID': 'deducted',
'SSID': 'deducted',
'APISID': 'deducted',
'SAPISID': 'deducted',
'__Secure-1PAPISID': 'deducted',
'__Secure-3PAPISID': 'deducted',
'NID': 'deducted',
'LSID': 'deducted',
'__Host-1PLSID': 'deducted',
'__Host-3PLSID': 'deducted',
'ACCOUNT_CHOOSER': 'deducted',
'__Host-GAPS': 'deducted'
}
osids in gen_cookies_and_osids: ['cloudconsole', 'cl']

https://console.cloud.google.com/accounts/SetOSID
req text(osid): < h1 >Unauthorized
< h2 >Error 401

Please check that:
Params output is empty
req text output is empty or brings out the 401 message from server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants