0
votes

I have been trying for a while now to get a batch file to check a discord nitro gift code to see if it is valid. I used code from a token checker but cant figure out what I need to change to make it work. when it runs and I put the nitro codes (or any text) in they return as valid when they are not.

:tokenchecker
echo [40;37mDrag the tokens file (.txt) to the console
set /p tpath="[40;30m.[40;37mPath: "
echo.
if not exist %tpath% echo  [40;31m[-] File not found &pause>nul & exit
for /F "usebackq tokens=*" %%T in ("%tpath%") do (
curl -s -H "Content-Type: application/json" -H "Authorization: %%T" https://discordapp.com/api/v8/users/@me > %temp%\tokenchecker.json
find /i "401: Unauthorized" %temp%\tokenchecker.json >nul
if errorlevel 1 (
echo  [40;32m[+] %%T
echo %%T>>hits.txt
) else (
echo  [40;31m[-] %%T
del %temp%\tokenchecker.json /q /f )
)
echo.
echo  [40;37mValid tokens have been saved in [40;32mhits.txt
pause

:nitrochecker
echo [40;37mDrag the nitro gifts file (.txt) to the console
set /p tpath="[40;30m.[40;37mPath: "
echo.
if not exist %tpath% echo  [40;31m[-] File not found &pause>nul & exit
for /F "usebackq tokens=*" %%T in ("%tpath%") do (
curl -s -H "Content-Type: application/json" -H "Authorization: %%T" https://discordapp.com/api/v6/entitlements/gift-codes/ > %temp%\tokenchecker.json 
find /i "401: Unauthorized" %temp%\tokenchecker.json >nul
if errorlevel 1 (
echo  [40;32m[+] %%T
echo %%T>>nitrohits.txt
) else (
echo  [40;31m[-] %%T
del %temp%\tokenchecker.json /q /f )
)
echo.
echo  [40;37mValid nitro gifts have been saved in [40;32mnitrohits.txt

I changed this link: https://discordapp.com/api/v8/users/@me to https://discordapp.com/api/v6/entitlements/gift-codes/ but that didn't work. If anyone could help me that would be great.

1

1 Answers

0
votes

When you send codes to the gift-code API, valid codes return the string "application_id". The API also expects the 16-character code to be sent as part of the URL, not the header (for example, https://discordapp.com/api/v6/entitlements/gift-codes/AAAAAAAAAAAAAAAA).

for /F "usebackq tokens=*" %%T in ("%tpath%") do (
    curl -ksi https://discordapp.com/api/v6/entitlements/gift-codes/%%T -o %temp%\tokenchecker.json 
    find /i "application_id" %temp%\tokenchecker.json >nul
    if errorlevel 1 (
        echo  [40;31m[-] %%T
        del %temp%\tokenchecker.json /q /f
    ) else (
        echo  [40;32m[+] %%T
        echo %%T>>nitrohits.txt
    )
)
echo.
echo  [40;37mValid nitro gifts have been saved in [40;32mnitrohits.txt

Note that I'm expecting the values in the nitro gifts file to only contain the 16-character code and not the http://discord.gift/ prefix.