add configurable fake IP to iauth
This commit is contained in:
parent
baecb9efbb
commit
58309c2cf8
@ -15,4 +15,5 @@ void amcus_config_load(struct amcus_config *cfg, const wchar_t *filename)
|
||||
GetPrivateProfileStringW(L"amcus", L"am_serial", L"ABGN6789012", cfg->am_serial, _countof(cfg->am_serial), filename);
|
||||
|
||||
es3sec_config_load(&cfg->dongle, filename);
|
||||
netenv_config_load(&cfg->netenv, filename);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "platform/es3sec.h"
|
||||
#include "platform/netenv.h"
|
||||
|
||||
struct amcus_config {
|
||||
bool enable;
|
||||
@ -13,6 +14,7 @@ struct amcus_config {
|
||||
wchar_t server_host[257];
|
||||
wchar_t am_serial[12];
|
||||
struct es3sec_config dongle;
|
||||
struct netenv_config netenv;
|
||||
};
|
||||
|
||||
void amcus_config_load(struct amcus_config *cfg, const wchar_t *filename);
|
||||
|
@ -8,10 +8,38 @@
|
||||
|
||||
#include "util/dprintf.h"
|
||||
static struct amcus_config config;
|
||||
// 16 0 5 6 9
|
||||
static char local_ip[16];
|
||||
static char subnet[16];
|
||||
static char router_ip[16];
|
||||
static char auth_srv_ip[16];
|
||||
|
||||
void iauth_set_config(struct amcus_config *cfg)
|
||||
{
|
||||
memcpy(&config, cfg, sizeof(*cfg));
|
||||
uint32_t netenv_ip_prefix = cfg->netenv.subnet;
|
||||
uint32_t netenv_ip_iface = cfg->netenv.subnet | cfg->netenv.addr_suffix;
|
||||
uint32_t netenv_ip_router = cfg->netenv.subnet | cfg->netenv.router_suffix;
|
||||
|
||||
sprintf_s(local_ip, _countof(local_ip),
|
||||
"%i.%i.%i.%i",
|
||||
(uint8_t) (netenv_ip_iface >> 24),
|
||||
(uint8_t) (netenv_ip_iface >> 16),
|
||||
(uint8_t) (netenv_ip_iface >> 8),
|
||||
(uint8_t) (netenv_ip_iface ));
|
||||
|
||||
sprintf_s(subnet, _countof(subnet),
|
||||
"%i.%i.%i.%i",
|
||||
(uint8_t) (netenv_ip_prefix >> 24),
|
||||
(uint8_t) (netenv_ip_prefix >> 16),
|
||||
(uint8_t) (netenv_ip_prefix >> 8),
|
||||
(uint8_t) (netenv_ip_prefix ));
|
||||
|
||||
sprintf_s(router_ip, _countof(router_ip),
|
||||
"%i.%i.%i.%i",
|
||||
(uint8_t) (netenv_ip_router >> 24),
|
||||
(uint8_t) (netenv_ip_router >> 16),
|
||||
(uint8_t) (netenv_ip_router >> 8),
|
||||
(uint8_t) (netenv_ip_router ));
|
||||
}
|
||||
|
||||
static ULONG REF_COUNT = 0;
|
||||
@ -165,13 +193,12 @@ static HRESULT STDMETHODCALLTYPE IAuth_GetCabinetConfig(IAuth FAR *This, struct
|
||||
strcpy_s(arr->pcbid, sizeof(arr->pcbid), am_serial);
|
||||
strcpy_s(arr->dongle_serial, sizeof(arr->dongle_serial), dongle_serial);
|
||||
|
||||
// TODO: Load fake IP addresses from config
|
||||
strcpy_s(arr->shop_router_ip, sizeof(arr->shop_router_ip), "192.168.123.254"); // router ip
|
||||
strcpy_s(arr->auth_server_ip, sizeof(arr->auth_server_ip), "192.168.1.114"); // "default" in dnshook
|
||||
strcpy_s(arr->local_ip, sizeof(arr->local_ip), "192.168.123.11"); // fake ip
|
||||
strcpy_s(arr->subnet_mask, sizeof(arr->subnet_mask), "255.255.225.0"); // fake subnet
|
||||
strcpy_s(arr->gateway, sizeof(arr->gateway), "192.168.123.254"); // router ip
|
||||
strcpy_s(arr->primary_dns, sizeof(arr->primary_dns), "192.168.1.3"); // ??
|
||||
strcpy_s(arr->shop_router_ip, sizeof(arr->shop_router_ip), router_ip); // router ip
|
||||
strcpy_s(arr->auth_server_ip, sizeof(arr->auth_server_ip), router_ip); // "default" in dnshook
|
||||
strcpy_s(arr->local_ip, sizeof(arr->local_ip), local_ip); // fake ip
|
||||
strcpy_s(arr->subnet_mask, sizeof(arr->subnet_mask), subnet); // fake subnet
|
||||
strcpy_s(arr->gateway, sizeof(arr->gateway), router_ip); // router ip
|
||||
strcpy_s(arr->primary_dns, sizeof(arr->primary_dns), router_ip); // Pokken doesn't read this it seems
|
||||
arr->hop_count = 1;
|
||||
arr->line_type = TYPE_FFT;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user