mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-03 15:38:22 +00:00
Update assimilate to work with modern APE format
This commit is contained in:
parent
6dcdf91458
commit
651826b660
4 changed files with 9 additions and 17 deletions
|
@ -17,11 +17,11 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/assert.h"
|
#include "libc/assert.h"
|
||||||
#include "libc/intrin/bits.h"
|
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/struct/stat.h"
|
#include "libc/calls/struct/stat.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/fmt/conv.h"
|
#include "libc/fmt/conv.h"
|
||||||
|
#include "libc/intrin/bits.h"
|
||||||
#include "libc/intrin/kprintf.h"
|
#include "libc/intrin/kprintf.h"
|
||||||
#include "libc/log/check.h"
|
#include "libc/log/check.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
|
@ -153,11 +153,16 @@ void GetMachoPayload(const char *image, size_t imagesize, int *out_offset,
|
||||||
const char *script;
|
const char *script;
|
||||||
regmatch_t rm[1 + 3] = {0};
|
regmatch_t rm[1 + 3] = {0};
|
||||||
int rc, skip, count, bs, offset, size;
|
int rc, skip, count, bs, offset, size;
|
||||||
if (!(script = memmem(image, imagesize, "'\n#'\"\n", 6))) {
|
|
||||||
|
if ((script = memmem(image, imagesize, "'\n#'\"\n", 6))) {
|
||||||
|
script += 6;
|
||||||
|
} else if ((script = memmem(image, imagesize, "#'\"\n", 4))) {
|
||||||
|
script += 4;
|
||||||
|
} else {
|
||||||
kprintf("%s: ape shell script not found\n", prog);
|
kprintf("%s: ape shell script not found\n", prog);
|
||||||
exit(5);
|
exit(5);
|
||||||
}
|
}
|
||||||
script += 6;
|
|
||||||
DCHECK_EQ(REG_OK, regcomp(&rx,
|
DCHECK_EQ(REG_OK, regcomp(&rx,
|
||||||
"bs=([ [:digit:]]+) "
|
"bs=([ [:digit:]]+) "
|
||||||
"skip=\"?([ [:digit:]]+)\"? "
|
"skip=\"?([ [:digit:]]+)\"? "
|
||||||
|
|
|
@ -36,7 +36,7 @@ local function main()
|
||||||
if IsPublicIp(GetClientAddr()) then
|
if IsPublicIp(GetClientAddr()) then
|
||||||
ServeError(403)
|
ServeError(403)
|
||||||
elseif GetMethod() == 'GET' or GetMethod() == 'HEAD' then
|
elseif GetMethod() == 'GET' or GetMethod() == 'HEAD' then
|
||||||
WriteForm("https://www.cloudflare.com/robots.txt")
|
WriteForm("https://justine.lol")
|
||||||
elseif GetMethod() == 'POST' then
|
elseif GetMethod() == 'POST' then
|
||||||
status, headers, payload = Fetch(GetParam('url'))
|
status, headers, payload = Fetch(GetParam('url'))
|
||||||
if status then
|
if status then
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
<!doctype html>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>redbean virtual host</title>
|
|
||||||
<h1>virtualbean.justine.lol</h1>
|
|
||||||
<p>This page uses redbean virtual hosting. Please refer to
|
|
||||||
<a href="//redbean.justine.lol">//redbean.justine.lol</a>
|
|
||||||
to see the primary instance.
|
|
|
@ -183,11 +183,6 @@ o/$(MODE)/tool/net/demo/seekable.txt.zip.o: private \
|
||||||
-B \
|
-B \
|
||||||
-0
|
-0
|
||||||
|
|
||||||
o/$(MODE)/tool/net/demo/virtualbean.html.zip.o: private \
|
|
||||||
ZIPOBJ_FLAGS += \
|
|
||||||
-Predbean.justine.lol \
|
|
||||||
-B
|
|
||||||
|
|
||||||
o/$(MODE)/tool/net/redbean-demo.com.dbg: \
|
o/$(MODE)/tool/net/redbean-demo.com.dbg: \
|
||||||
$(TOOL_NET_DEPS) \
|
$(TOOL_NET_DEPS) \
|
||||||
o/$(MODE)/tool/net/redbean.o \
|
o/$(MODE)/tool/net/redbean.o \
|
||||||
|
@ -227,7 +222,6 @@ o/$(MODE)/tool/net/redbean-demo.com.dbg: \
|
||||||
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
||||||
o/$(MODE)/tool/net/demo/404.html.zip.o \
|
o/$(MODE)/tool/net/demo/404.html.zip.o \
|
||||||
o/$(MODE)/tool/net/demo/seekable.txt.zip.o \
|
o/$(MODE)/tool/net/demo/seekable.txt.zip.o \
|
||||||
o/$(MODE)/tool/net/demo/virtualbean.html.zip.o \
|
|
||||||
o/$(MODE)/tool/net/demo/.lua/.zip.o \
|
o/$(MODE)/tool/net/demo/.lua/.zip.o \
|
||||||
o/$(MODE)/tool/net/demo/.lua/mymodule.lua.zip.o \
|
o/$(MODE)/tool/net/demo/.lua/mymodule.lua.zip.o \
|
||||||
o/$(MODE)/tool/net/demo/.reload.lua.zip.o \
|
o/$(MODE)/tool/net/demo/.reload.lua.zip.o \
|
||||||
|
|
Loading…
Add table
Reference in a new issue