Post: GTA V SPRX Auth Connection
03-07-2019, 06:08 PM #1
(adsbygoogle = window.adsbygoogle || []).push({}); Just something I've had sitting on the side for a while. It's a License Key Auth system for GTA V.

This is the code for your Main Thread

    bool Authed;
bool firstRun;
void Thread(uint64_t nothing)
{
for (;Winky Winky
{
__asm("nop");
__asm("mr %r3, %r4");
__asm("mr %r4, %r3");
GetKey();
if (isRequesthook(Key))
{
if (!firstRun)
{
sleep(5000);
Dialog::msgdialog_mode = Dialog::MODE_STRING_OK;
Dialog::Show("Welcome Message\nAuth Successful\nThird Line\nFourth Line");
sleep(25000); //Wait until native table initialization
g_Natives = (Native_s**)FindNativeTableAddress();
PatchInJump(NativeAddress(NativeAddress2, true), (int)Hook, false); //IS_PLAYER_ONLINE
firstRun = true;
sys_ppu_thread_exit(nothing);
}
}
__asm("nop");
__asm("mr %r3, %r4");
__asm("mr %r4, %r3");
sleep(120000);

}
sleep(100);
}


And add this to your Sockets.h

    #include <sys/sys_time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/syscall.h>
#include <sys/timer.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <netex/net.h>
#include <netex/errno.h>
#include <string.h>
#pragma region Declarations
#include <sys/ppu_thread.h>
#include <string.h>
#include <sys/sys_time.h>
#include <sys/time_util.h>
#include <stdarg.h>
#include <assert.h>
#include <sys/process.h>
#include <sys/memory.h>
#include <sys/timer.h>
#include <sys/return_code.h>
#include <sys/prx.h>
#include <stddef.h>
#include <math.h>
#include <stdarg.h>
#include <cellstatus.h>
#include <typeinfo>
#include <vector>
#include <pthread.h>
#include <locale.h>
#include <cell/error.h>
#include <sys/paths.h>
#include <time.h>
#include <net\if_dl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <cell/cell_fs.h>
#include <cell/sysmodule.h>
#include <stdio.h>
#include <string.h>
#include <cell/fs/cell_fs_errno.h>
#include <cell/fs/cell_fs_file_api.h>
#include <ppu_intrinsics.h>
#include <cstdlib>
#include "Dialog.h"
#pragma comment(lib, "net_stub")
#pragma comment(lib, "netctl_stub")

#define SERVER_PORT htons(80)

int Socket;
struct hostent *Host;
struct sockaddr_in SocketAddress;
char bufferReturn[10000];
char RequestBuffer[2000];

char *HookName;

int WriteinConsole(const char * s)
{
uint32_t len;
system_call_4(403, 0, (uint64_t)s, std::strlen(s), (uint64_t)&len);
return_to_user_prog(int);
}

void SleepMM(usecond_t time)
{
sys_timer_usleep(time * 1000);
}

char* SocketRequest(char* URL, char* Key, char* Path = "")
{
Host = gethostbyname(URL);
SocketAddress.sin_addr.s_addr = *((unsigned long*)Host->h_addr);
SocketAddress.sin_family = AF_INET;
SocketAddress.sin_port = SERVER_PORT;
Socket = socket(AF_INET, SOCK_STREAM, 0);
if (connect(Socket, (struct sockaddr *)&SocketAddress, sizeof(SocketAddress)) != 0) {
return "CONNECTION ERROR";
}
strcpy(RequestBuffer, "GET /");
if (strlen(Path) > 0) {
strcat(RequestBuffer, Path);
}
strcat(RequestBuffer, Key);
strcat(RequestBuffer, " HTTP/1.0
HOST: ");
strcat(RequestBuffer, URL);
strcat(RequestBuffer, "

");

send(Socket, RequestBuffer, strlen(RequestBuffer), 0);

while (recv(Socket, bufferReturn, 10000, 0) > 0)
{
return bufferReturn;
SleepMM(1);
}
socketclose(Socket);
}

void encryptDecrypt(char *input, char *output) {
char key[] = { 'K', 'C', 'Q' }; //Can be any chars, and any size array


for (int i = 0; i < strlen(input); i++) {
output[i] = input[i] ^ key[i % (sizeof(key) / sizeof(char))];
}
}

bool IsRequest(char* Key)
{
char* penis = SocketRequest("AddYourURLHere", Key, "licensecheck.php?key=");
char* s = strstr(penis, "Key is valid");
if (s != NULL)
{

return true;
}
else
{
return false;
}
}

int ExitThisShit()
{
system_call_1(41, 0);
return_to_user_prog(int);
}
char Key[15];
char* GetKey()
{
int fd;
int ret;
uint64_t pos;
uint64_t nread;

cellMsgDialogProgressBarInc(0, 1);
cellMsgDialogProgressBarSetMsg(0, "Loading Key...");
ret = cellFsOpen("/dev_hdd0/tmp/key.txt", 0, &fd, NULL, 0);
if (!ret)
{
cellFsLseek(fd, 0, CELL_FS_SEEK_SET, &pos);
ret = cellFsRead(fd, Key, sizeof(Key), &nread);
if (!ret)
{
cellFsClose(fd);
}
else
{
cellMsgDialogClose(5.0);
SleepMM(500);
Dialog::msgdialog_mode = 2;
Dialog::Show("Key failed to Read!");
}
}
else
{
cellMsgDialogClose(5.0);
SleepMM(500);
Dialog::msgdialog_mode = 2;
Dialog::Show("Key failed to load!");
}
return;
}

bool isNumericChar1(char x)
{
return (x >= '0' && x <= '9'Winky Winky ? true : false;
}

int myAtoi(char *str)
{
if (*str == NULL)
return 0;

int res = 0; // Initialize result
int sign = 1; // Initialize sign as positive
int i = 0; // Initialize index of first digit

// If number is negative, then update sign
if (str[0] == '-'Winky Winky
{
sign = -1;
i++; // Also update index of first digit
}

// Iterate through all digits of input string and update result
for (; str[i] != '\0'; ++i)
{
if (isNumericChar1(str[i]) == false)
return 0; // You may add some lines to write error message
// to error stream

res = res * 10 + str[i] - '0';
}

// Return result with sign
return sign*res;
}

void WriteByte(int Address, unsigned char Input)
{
*(unsigned char*)Address = Input;
}

void WriteBytes(int Address, unsigned char Input, int Length)
{
for (int i = 0; i < Length; i++)
WriteByte(Address + i, Input);
}

int HookAddress = 0;
bool isRequesthook(char* Key)
{
char* add = SocketRequest("Add Your Site URL", Key, "hook.php?key=");
char* add2 = strstr(add, "40");
HookAddress = myAtoi(add2);
char *begin = bufferReturn;
char *end = begin + sizeof(bufferReturn);
std::fill(begin, end, 0);
}


All you need for this to work is the original Native Address, and the Auth PHP files. I have uploaded a set of Auth Files for this method which can be found:
licensecheck.php: https://pastebin.com/raw/uGvDEjy4
Hook.php: https://pastebin.com/raw/Jgq7WJ0J

Add on note:

This works with the Panel released by Passion if you struggle to set one up. Database layout is the same. Enjoy.
Last edited by MrFawkes1337 ; 03-08-2019 at 09:17 AM. Reason: Realised this was my IP Auth, will release Mac in another post.

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo