Skip to content
This repository has been archived by the owner on Dec 13, 2017. It is now read-only.

Commit

Permalink
pass hostname to autorun
Browse files Browse the repository at this point in the history
  • Loading branch information
kgsws committed Nov 27, 2017
1 parent 44c27fa commit 80c275d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions http.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ static FILE http_stdout;
static int sck; // HTTP socket

static const char http_get_template[] = "GET /files/%s HTTP/1.1\r\nHost: %s\r\nUser-Agent: ACE loader\r\nAccept-Encoding: none\r\nConnection: close\r\n\r\n";
static char http_host[128];
char http_hostname[128];

static struct sockaddr_in server_addr =
{
Expand Down Expand Up @@ -117,7 +117,7 @@ int http_init(const char *hostname)
// printf("- host '%s' IP is %i.%i.%i.%i\n", hostname, server_addr.sin_addr.s_addr & 0xFF, (server_addr.sin_addr.s_addr >> 8) & 0xFF, (server_addr.sin_addr.s_addr >> 16) & 0xFF, server_addr.sin_addr.s_addr >> 24);

// copy hostname
strncpy(http_host, hostname, sizeof(http_host)-1);
strncpy(http_hostname, hostname, sizeof(http_hostname)-1);

// prepare HTTP stdout
http_stdout._write = stdout_http;
Expand Down Expand Up @@ -150,7 +150,7 @@ int http_get_file(const char *path, void *buff, uint64_t maxsize)
}

// make a request
fprintf(&http_stdout, http_get_template, path, http_host);
fprintf(&http_stdout, http_get_template, path, http_hostname);

// get an answer
ret = parse_header(temp, sizeof(temp), &offs, &got);
Expand Down
2 changes: 2 additions & 0 deletions http.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

extern char http_hostname[128];

int http_init(const char *hostname);
void http_paste_ip(uint32_t *target);

Expand Down
1 change: 1 addition & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ void hook_func(uint64_t arg0)
uint64_t r;
printf("- starting autorun\n");
nro_arg_name("autorun");
nro_add_arg(http_hostname);
r = nro_execute(heap_base, ret);
printf("- NRO returned 0x%016lX\n", r);
// do not exit for GUIs
Expand Down

0 comments on commit 80c275d

Please sign in to comment.