Commit: 6550af1b2f12d5c0870c067710d4cca4c43f62a6 Parent: 684cc056787857ec61d9abebeaabdba776b4f6d4 Author: Vi Grey Date: 2023-11-21 06:35 UTC Summary: Add article and simplify repo for tmp.0ut vol 3 .gitignore | 3 + 31.txt | 78 ++++++++++++++++++++ README.txt | 25 ------- gopher-server.go | 199 -------------------------------------------------- gopher-server/gen-polyglot.sh | 40 ++++++++++ go.mod => gopher-server/go.mod | 0 gopher-server/gopher-server.go | 313 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ index.gph | 6 -- index.gph-example | 20 ----- polyglot-instructions.txt | 38 ---------- 10 files changed, 434 insertions(+), 288 deletions(-) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a9c8fd3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +gopher-server/gopher-server +gopher-server/cat.zip +gopher-server/gopher-server-zip-polyglot.zip diff --git a/31.txt b/31.txt new file mode 100644 index 0000000..26cd37b --- /dev/null +++ b/31.txt @@ -0,0 +1,78 @@ + + ████▓░░░░█░░░░░░░░░░█░░░█ + █░██░░███░░░░█████░░░░░███░█ + ░░░█░░ █░░░░░ ░█░█░░░░██░▒ + ██░░ ███░░░░ ████░░░░░█ + █░▓ ▒██░░░█ █ ██░░░░░█ + ██░░█░░░░█░░▒█░░░░░█▒░░░█ + █░░░░░░░░░█ █ █░░░░░░░░░░░░█ + ▒░░░░░░░░░░░▒██▒█░░░░░░░░░█░░░█ + █░░██░░░░░░░░█░░░░░░░░░░▓░░░░░█ + ▓░░░░░▒███▓▒████░░░░██▒░░░░░░░█ + ██░░░░░░█ █ ██░░░░░░░░░█ + ██░░░░░░█ █ █░░░░░░░░░█▓ + █░░░░░░█ ▓ █░░░░░░░░█ + █░░░░░░░░░░░░░░░░░░░░░█ + █░░░░░░░░░░░░░░░██ + ██░░░░░░█ + ██ + +Long Live Gopher! This Zine Is Also A Gopher Server +~Vi Grey +----------------------------------------------------------------------- + +I was asked only a little bit before the release of this issue if I +wanted to help make the ZIP file release of this issue a polyglot file. + +Making polyglot files where one part of the file is a ZIP file tends to +be pretty simple. Basically concatenate a file with the ZIP file to +make a third file and adjust the ZIP file offsets in that third file so +the ZIP file part works without throwing any errors. The only problem +though is that's pretty boring. It's more fun to make sure the ZIP file +part is as important to the polyglot file as anything else! + +My solution was making a Gopher Server (gopherhole) that can serve the +content of the ZIP file. There's already an HTTP version of the zine, +so why not add a Gopher version? Besides, I'm a Minnesotan and feel +like I should rep the big competitor to the World Wide Web that came +from this state, even if the University messed it all up by trying to +monetize it... + +On Linux x86_64, you can make this ZIP file executable with `chmod +x` +and run the file in a terminal. It will start a Gopher Server at +gopher://localhost:2311 (2311 was chosen because this zine issue's +release date is in 2023-11) which can be visited with your gopher client +of choice. + +If you want to use a different address or different port, you can use +the flag options --host and --port , for instance +`--host mappedhost --port 9070` if you wanted the gopherhole to listen +at gopher://mappedhost:9070 instead of gopher:localhost:2311. You can +also specify a ZIP file instead of using the executable as the ZIP file +by using the --zip flag option, for instance `--zip test.zip` if +you want the gopherhole to serve content from test.zip. + +If you want to make the ZIP file of this issue a Gopher server for your +system, I have included the gopher-server source code and a shell +script called `gen-polyglot.sh` to generate the polyglot file. Just be +sure to edit the goos and goarch variables in the shell script with the +correct OS and architecture settings for your computer. To use +gen-polyglot.sh, you can run: + +``` +./gen-polyglot.sh /path/to/tmp.0ut.3.txt.zip +``` + +where `/path/to/tmp.0ut.3.txt.zip` is the path to the tmp.0ut volume 3 +ZIP file. + +The dependencies to compile the go-server source code and create the +polyglot file are: +- go >= 1.15 +- zip + +File List: +gopher-server +├── gen-polyglot.sh +├── go.mod +└── gopher-server.go diff --git a/README.txt b/README.txt deleted file mode 100644 index 6e8dcdc..0000000 --- a/README.txt +++ /dev/null @@ -1,25 +0,0 @@ -Gopher Server --------------- - -A gopher server for an executable+ZIP polyglot file that hosts the -content in the ZIP file portion of the polyglot file. - -Instructions to produce the polyglot file are included in the file -`polyglot-instructions.txt`. - -An `index.gph` file is included. It is incredibly important that the -tabs and the first character of each line be correct, as gophermap -files are quite picky. An example index gophermap file is included at -`index.gph-example`, which is a gophermap for the tmp.0ut zine for -Volume 1. - -The gopher server is expecting an index.gph file at the root of the -ZIP file. - -Upon running the server, the Gopherhole will be listening at TCP -"localhost:2311" unless specified using the --host and/or --port flag -arguments. For more details, you can run the server with -h or --help. - -Port 2311 was chosen for the 2023-11 release of tmp.0ut Volume 3 and -because it's an unprivileged port, unlike port 70, which is used by -default for Gopherholes. diff --git a/gopher-server.go b/gopher-server.go deleted file mode 100644 index 45a6ee4..0000000 --- a/gopher-server.go +++ /dev/null @@ -1,199 +0,0 @@ -/* - +------------------------+ - | Gopher Server | - | Programmed by Vi Grey | - +------------------------+ - - This is meant to be compiled and prepended to a ZIP file to make it an - Executable+ZIP polyglot file with the intention of the ZIP file - hosting the content for the Gopherhole. Please make sure an - "index.gph" gophermap file is included in the root of the ZIP file. - If run without any arguments, the ZIP file will be the executable - itself, and the Gopherhole will be listening on localhost:2311 (2311 - chosen because 2023-11 for the release of tmp.0ut Volume 3) - - Do whatever the heck you want to with this code, just don't blame me - if anything happens... - - GO GOLDEN GOPHERS! -*/ - -package main - -import ( - "archive/zip" - "fmt" - "io" - "log" - "net" - "os" - "path/filepath" - "strconv" - "strings" - "time" -) - -var ( - port = 2311 - host = "localhost" - zipFilePath string - zipReader *zip.ReadCloser -) - -// Print error log and close program with error code 1 if err not nil -func handleErr(err error) { - if err != nil { - log.Fatalf("%s\nExiting...\n", err) - } -} - -// Open ZIP file and get Reader -func getZIPFileReader() { - var err error - zipReader, err = zip.OpenReader(zipFilePath) - handleErr(err) -} - -// Get request from gopher client and serve page from ZIP file if path -// exists inside of ZIP file -func handleGopherConnection(conn net.Conn) { - var rBuf []byte - var request string - // Continue reading from connection until first \r\n is found - for { - rBuf = make([]byte, 2048) - n, err := conn.Read(rBuf) - if err != nil || n == 0 { - break - } - request += string(rBuf[:n]) - // Gopher path request ends at first instance of \r\n - nlIndex := strings.Index(request, "\r\n") - if nlIndex > -1 { - reqPath := request[:nlIndex] // Gopher path request - if reqPath == "" || reqPath == "/" { - // Set path to index.gph if request is root path - reqPath = "index.gph" - } - for _, zipFile := range zipReader.File { - if filepath.Join("/", reqPath) == filepath.Join("/", zipFile.Name) { - // /reqPath is in zip directory root - f, err := zipFile.Open() - handleErr(err) - defer f.Close() - // Write file content from zip file to connection - io.Copy(conn, f) - conn.Write([]byte("\r\n.\r\n")) - return - } - } - // Send error to gopher client. Essentially the same as HTTP 404 - conn.Write([]byte("3The selected resource does not exist\t\t" + - "fake\tfake\t0\r\n.\r\n")) - return - } - } - // Send error to gopher client. Essentially the same as HTTP 400 - conn.Write([]byte("3Invalid Request\t\tfake\tfake\t0\r\n.\r\n")) -} - -// Start the gopher server at specified host and port (default -// localhost:2311) -func startGopherServer() { - listener, err := net.Listen("tcp", - fmt.Sprintf("%s:%d", host, port)) - handleErr(err) - for { - if conn, err := listener.Accept(); err == nil { - go func() { - defer conn.Close() - // Close connection when request handled or after 30 seconds - conn.SetReadDeadline(time.Now().Add(30 * time.Second)) - handleGopherConnection(conn) - }() - } - } -} - -// Display help message and close program -func displayHelp() { - fmt.Printf(`Usage %s [OPTIONS]... - -Options: - -h, --help Print Help (this message) and exit - --host TCP address for gopher server to listen on - (default: "localhost") - --port TCP port to listen on (default: 2311) - --zip Path to ZIP file that hosts the content - (default: this executable file itself) -`, os.Args[0]) -} - -// Get a string value from args[x+1] -func getFlagStrValue(args []string, x, argsLen int) (string, error) { - if x+1 >= argsLen { - err := fmt.Errorf("%s: flag `%s` missing value\n Use `%s --help` for "+ - "details", os.Args[0], args[x], os.Args[0]) - return "", err - } - return args[x+1], nil -} - -// Get an integer value of 1-65535 from args[x+1] -func getFlagPortValue(args []string, x, argsLen int) (int, error) { - strVal, err := getFlagStrValue(args, x, argsLen) - if err != nil { - return 0, err - } - portVal, _ := strconv.Atoi(strVal) - if portVal < 1 || portVal > 65535 { - err = fmt.Errorf("%s: flag `%s` value must be a number value of "+ - "1-65535\nUse `%s --help` for details", - os.Args[0], args[x], os.Args[0]) - return 0, err - } - return portVal, nil -} - -func init() { - var err error - // Get executable path in case --zip flag not used - zipFilePath, err = os.Executable() - handleErr(err) - args := os.Args[1:] - argsLen := len(args) - // Flag checking (--host, -h, --help, --port, and --zip) - for x := 0; x < argsLen; x++ { - switch strings.ToLower(args[x]) { - case "-h", "--help": - displayHelp() - os.Exit(0) - case "--host": - // User specified TCP listening address - hostVal, err := getFlagStrValue(args, x, argsLen) - x++ - handleErr(err) - host = hostVal - case "--port": - // User specified TCP listening port - portVal, err := getFlagPortValue(args, x, argsLen) - x++ - handleErr(err) - port = portVal - case "--zip": - // User specified ZIP file path - zipFilePathVal, err := getFlagStrValue(args, x, argsLen) - x++ - handleErr(err) - zipFilePath = zipFilePathVal - } - } -} - -func main() { - getZIPFileReader() - defer zipReader.Close() - fmt.Printf("Starting Gopherhole at gopher://%s:%d\n", - host, port) - startGopherServer() -} diff --git a/gopher-server/gen-polyglot.sh b/gopher-server/gen-polyglot.sh new file mode 100755 index 0000000..955d5d0 --- /dev/null +++ b/gopher-server/gen-polyglot.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# This program builds gopher-server and generates an executable+ZIP +# polyglot file. A file called "cat.zip" will be created as a +# byproduct and can be removed after. The resulting polyglot file +# will be called "gopher-server-zip-polyglot.zip" + +# Be sure to set the Go OS and Go Arch to what system you want the +# compiled Go program to be for +goos="linux" +goarch="amd64" + +# Possible GOOS/GOARCH options +# aix/ppc64 freebsd/amd64 linux/mipsle openbsd/386 +# android/386 freebsd/arm linux/ppc64 openbsd/amd64 +# android/amd64 illumos/amd64 linux/ppc64le openbsd/arm +# android/arm js/wasm linux/s390x openbsd/arm64 +# android/arm64 linux/386 nacl/386 plan9/386 +# darwin/386 linux/amd64 nacl/amd64p32 plan9/amd64 +# darwin/amd64 linux/arm nacl/arm plan9/arm +# darwin/arm linux/arm64 netbsd/386 solaris/amd64 +# darwin/arm64 linux/mips netbsd/amd64 windows/386 +# dragonfly/amd64 linux/mips64 netbsd/arm windows/amd64 +# freebsd/386 linux/mips64le netbsd/arm64 windows/arm + +if [ -z "$1" ]; then + echo "Must include path to ZIP file" +else + # Build the gopher server executable + # Concatenate executable with ZIP file to make polyglot file + # Realign offsets of ZIP file so ZIP file works again + echo "Building for gopher-server for $goos/$goarch" && \ + GOOS="$goos" GOARCH="$goarch" go build -ldflags="-s -w" -o "./gopher-server" && \ + cat "./gopher-server" "$1" > "cat.zip" && \ + zip -F "cat.zip" --out "gopher-server-zip-polyglot.zip" && \ + echo "gopher-server-zip-polyglot.zip Created for $goos/$goarch." && \ + echo "You can make gopher-server-zip-polyglot.zip executable with:" && \ + echo " chmod +x gopher-server-zip-polyglot.zip" + echo "You can delete cat.zip." +fi diff --git a/go.mod b/gopher-server/go.mod similarity index 100% rename from go.mod rename to gopher-server/go.mod diff --git a/gopher-server/gopher-server.go b/gopher-server/gopher-server.go new file mode 100644 index 0000000..654d308 --- /dev/null +++ b/gopher-server/gopher-server.go @@ -0,0 +1,313 @@ +/* + +------------------------+ + | Gopher Server | + | Programmed by Vi Grey | + +------------------------+ + + This is meant to be compiled and prepended to a ZIP file to make it an + Executable+ZIP polyglot file with the intention of the ZIP file + hosting the content for the Gopherhole. + + If run without any arguments, the ZIP file will be the executable + itself, and the Gopherhole will be listening on localhost:2311 (2311 + chosen because 2023-11 for the release of tmp.0ut Volume 3) + + Do whatever the heck you want to with this code, just don't blame me + if anything happens... + + GO GOLDEN GOPHERS! +*/ + +package main + +import ( + "archive/zip" + "fmt" + "io" + "log" + "mime" + "net" + "os" + "path/filepath" + "strconv" + "strings" + "time" +) + +const ( + DEFAULT_CONTENT = `itmp.0ut #003 - 2023-11 fake 0 +i fake 0 +001 Intro ~ t0 /txt/1.txt {ADDR} {PORT} +002 Second Part To Hell Interview ~ t0 /txt/2.txt {ADDR} {PORT} +003 UNIX VIRUSES 25th Anniversary ~ silvio /txt/3.txt {ADDR} {PORT} +004 Hijacking __cxa_finalize to achieve entry point obscuring ~ vrzh /txt/4.txt {ADDR} {PORT} +005 Linux.ElizaCanFix.asm ~ vrzh /txt/5.txt {ADDR} {PORT} +006 Concealing Namespaces Within a File Descriptor ~ Fanda Uchytil /txt/Linux.ElizaCanFix.asm {ADDR} {PORT} +007 Dumping libc memory space to bypass ASLR ~ jonaslyk /txt/7.txt {ADDR} {PORT} +008 ARM32 ELF Sizecoding ~ deater /txt/8.txt {ADDR} {PORT} +009 A Silver Bullet To ELF Projects ~ echel0n /txt/9.txt {ADDR} {PORT} +010 in-memory-only fd-less ELF execution (with Perl) ~ isra /txt/10.txt {ADDR} {PORT} +011 isra_exec_elf64.pl ~ isra /txt/isra_exec_elf64.pl {ADDR} {PORT} +012 u used 2 call me on my polymorphic shell phone ~ ic3qu33n /txt/12.txt {ADDR} {PORT} +013 Weird ELFs, or a tale of breaking parsers once again ~ g1inko /txt/13.txt {ADDR} {PORT} +014 inspect0rGadget.asm - x64 ROP Gadget Finder ~ s01den /txt/14.txt {ADDR} {PORT} +015 Reverse Text Disinfector ~ qkumba /txt/15.test-1.c {ADDR} {PORT} +016 RE of Linux.Nasty.asm ~ qkumba /txt/16.txt {ADDR} {PORT} +017 Linux.Anansi.c ~ sad0p /txt/Linux.Anansi.c {ADDR} {PORT} +018 Linux.Slinger.asm ~ lvti /txt/Linux.Slinger.asm {ADDR} {PORT} +019 LKM Golf ~ rqu & netspooky /txt/19.txt {ADDR} {PORT} +020 easylkb: Easy Linux Kernel Builder ~ ackmage & netspooky /txt/20.txt {ADDR} {PORT} +021 23 Open Problems for Digital Self-Replicators ~ Second Part To Hell /txt/21.txt {ADDR} {PORT} +022 Cramming a Tiny Program into a Tiny ELF File: A Case Study ~ lm978 /txt/22.txt {ADDR} {PORT} +023 silent syscall hooking on arm64 linux by patching svc handler ~ wintermute /txt/23.txt {ADDR} {PORT} +024 HVice - HyperVisor intrusion countermeasure electronics ~ wintermute /txt/24.txt {ADDR} {PORT} +025 BGGP4 Recap ~ Binary Golf Association /txt/25.txt {ADDR} {PORT} +026 LLMorpher ~ Second Part To Hell /txt/26.txt {ADDR} {PORT} +027 QRLog Malware Analysis ~ mauro /txt/27.txt {ADDR} {PORT} +028 HandJar.B ~ r3s1stanc3 /txt/28.txt {ADDR} {PORT} +029 ClassWar ~ r3s1stanc3 /txt/29.txt {ADDR} {PORT} +030 linkin.pl ~ isra /txt/linkin.pl {ADDR} {PORT} +031 Long Live Gopher! This Zine Is Also A Gopher Server ~ Vi Grey /txt/31.txt {ADDR} {PORT} +i fake 0 +iFor the html version of this zine, please visit fake 0 +hhttps://tmpout.sh/3/ URL:https://tmpout.sh/3/ fake 0` +) + +var ( + port = 2311 + host = "localhost" + zipFlag bool + zipFilePath string + zipReader *zip.ReadCloser +) + +// Print error log and close program with error code 1 if err not nil +func handleErr(err error) { + if err != nil { + log.Fatalf("%s\nExiting...\n", err) + } +} + +// Return MIME type based on file extension of path +func getMIMEType(path string) string { + return mime.TypeByExtension(strings.ToLower(filepath.Ext(path))) +} + +// Open ZIP file and get Reader +func getZIPFileReader() { + var err error + zipReader, err = zip.OpenReader(zipFilePath) + handleErr(err) +} + +func sendGeneratedGophermap(reqPath string, conn net.Conn) { + reqPathFull := filepath.Join("/", reqPath) + if reqPathFull != "/" { + // Add slash to reqPath if it's not root path + reqPathFull += "/" + } + conn.Write([]byte(fmt.Sprintf("i%s Gophermap\t\tfake\t0\r\n", reqPathFull))) + for _, zipFile := range zipReader.File { + filename := filepath.Join("/", zipFile.Name) + if strings.Index(filename, reqPathFull) == 0 { + //zipFile exists inside reqPath + // Get path name without reqPath + p := filename[len(reqPathFull):] + if filepath.Dir(p) == "." { + // Path is a is in the base directory of reqPath + itemType := "0" + mimeType := getMIMEType(p) + switch { + case zipFile.FileInfo().IsDir(): + // Path is a directory + // Add "/" to end of file name to show it's a directory + itemType = "1" + p = filepath.Join(p) + "/" + conn.Write([]byte(fmt.Sprintf("1%s\t%s\t%s\t%d\r\n", + filepath.Join(p)+"/", filename, host, port))) + case strings.Contains(mimeType, "image/"): + // Path is an image + if strings.Contains(mimeType, "image/gif") { + itemType = "g" + } else { + itemType = "I" + } + case strings.Contains(mimeType, "audio/"): + // Path is audio + itemType = "s" + } + // so line is txt file line + conn.Write([]byte(fmt.Sprintf("%s%s\t%s\t%s\t%d\r\n", + itemType, p, filename, host, port))) + } + } + } + conn.Write([]byte(".\r\n")) +} + +// Get request from gopher client and serve page from ZIP file if path +// exists inside of ZIP file +func handleGopherConnection(conn net.Conn) { + var rBuf []byte + var request string + // Continue reading from connection until first \r\n is found + for { + rBuf = make([]byte, 2048) + n, err := conn.Read(rBuf) + if err != nil || n == 0 { + break + } + request += string(rBuf[:n]) + // Gopher path request ends at first instance of \r\n + nlIndex := strings.Index(request, "\r\n") + if nlIndex > -1 { + reqPath := request[:nlIndex] // Gopher path request + if reqPath == "" || reqPath == "/" { + // reqPath is the root gophermap + if !zipFlag { + // zipFlag was not specified, so should be polyglot ZIP + // Replace {PORT} and {ADDR} of DEFAULT_CONTENT to specified + // values + gophermap := strings.Replace(DEFAULT_CONTENT, "{PORT}", + strconv.Itoa(port), -1) + gophermap = strings.Replace(gophermap, "{ADDR}", + host, -1) + conn.Write([]byte(gophermap)) + conn.Write([]byte("\r\n.\r\n")) + return + } else { + sendGeneratedGophermap(reqPath, conn) + return + } + } else { + for _, zipFile := range zipReader.File { + if filepath.Join("/", reqPath) == filepath.Join("/", zipFile.Name) { + // /reqPath is in zip directory root + if zipFile.FileInfo().IsDir() { + // reqPath is directory + sendGeneratedGophermap(reqPath, conn) + return + } else { + // reqPath is file + f, err := zipFile.Open() + handleErr(err) + defer f.Close() + // Write file content from zip file to connection + io.Copy(conn, f) + conn.Write([]byte("\r\n.\r\n")) + return + } + } + } + } + // Send error to gopher client. Essentially the same as HTTP 404 + conn.Write([]byte("3The selected resource does not exist\tfake\t" + + "fake\t0\r\n.\r\n")) + return + } + } + // Send error to gopher client. Essentially the same as HTTP 400 + conn.Write([]byte("3Invalid Request\tfake\tfake\t0\r\n.\r\n")) +} + +// Start the gopher server at specified host and port (default +// localhost:2311) +func startGopherServer() { + listener, err := net.Listen("tcp", + fmt.Sprintf("%s:%d", host, port)) + handleErr(err) + for { + if conn, err := listener.Accept(); err == nil { + go func() { + defer conn.Close() + // Close connection when request handled or after 30 seconds + conn.SetReadDeadline(time.Now().Add(30 * time.Second)) + handleGopherConnection(conn) + }() + } + } +} + +// Display help message and close program +func displayHelp() { + fmt.Printf(`Usage %s [OPTIONS]... + +Options: + -h, --help Print Help (this message) and exit + --host TCP address for gopher server to listen on + (default: "localhost") + --port TCP port to listen on (default: 2311) + --zip Path to ZIP file that hosts the content + (default: this executable file itself) +`, os.Args[0]) +} + +// Get a string value from args[x+1] +func getFlagStrValue(args []string, x, argsLen int) (string, error) { + if x+1 >= argsLen { + err := fmt.Errorf("%s: flag `%s` missing value\n Use `%s --help` for "+ + "details", os.Args[0], args[x], os.Args[0]) + return "", err + } + return args[x+1], nil +} + +// Get an integer value of 1-65535 from args[x+1] +func getFlagPortValue(args []string, x, argsLen int) (int, error) { + strVal, err := getFlagStrValue(args, x, argsLen) + if err != nil { + return 0, err + } + portVal, _ := strconv.Atoi(strVal) + if portVal < 1 || portVal > 65535 { + err = fmt.Errorf("%s: flag `%s` value must be a number value of "+ + "1-65535\nUse `%s --help` for details", + os.Args[0], args[x], os.Args[0]) + return 0, err + } + return portVal, nil +} + +func init() { + var err error + // Get executable path in case --zip flag not used + zipFilePath, err = os.Executable() + handleErr(err) + args := os.Args[1:] + argsLen := len(args) + // Flag checking (--host, -h, --help, --port, and --zip) + for x := 0; x < argsLen; x++ { + switch strings.ToLower(args[x]) { + case "-h", "--help": + displayHelp() + os.Exit(0) + case "--host": + // User specified TCP listening address + hostVal, err := getFlagStrValue(args, x, argsLen) + x++ + handleErr(err) + host = hostVal + case "--port": + // User specified TCP listening port + portVal, err := getFlagPortValue(args, x, argsLen) + x++ + handleErr(err) + port = portVal + case "--zip": + // User specified ZIP file path + zipFilePathVal, err := getFlagStrValue(args, x, argsLen) + x++ + handleErr(err) + zipFilePath = zipFilePathVal + zipFlag = true + } + } +} + +func main() { + getZIPFileReader() + defer zipReader.Close() + fmt.Printf("Starting Gopherhole at gopher://%s:%d\n", + host, port) + startGopherServer() +} diff --git a/index.gph b/index.gph deleted file mode 100644 index 44987f2..0000000 --- a/index.gph +++ /dev/null @@ -1,6 +0,0 @@ -itmp.0ut Volume 3 - November 2023 fake 0 -i fake 0 -03.0 Intro (tmp.0ut Staff) /txt/0.txt localhost 2311 -03.X Title (Author) /txt/path.txt localhost 2311 -03.X Title (Author) /txt/path.txt localhost 2311 -03.X Title (Author) /txt/path.txt localhost 2311 diff --git a/index.gph-example b/index.gph-example deleted file mode 100644 index ff92070..0000000 --- a/index.gph-example +++ /dev/null @@ -1,20 +0,0 @@ -itmp.0ut Volume 1 - April 2021 fake 0 -i fake 0 -01.0 Intro (tmp.0ut Staff) /txt/0.txt localhost 2311 -01.1 Dead Bytes (xcellerator) /txt/1.txt localhost 2311 -01.2 Implementing the PT_NOTE Infection Method In x64 Assembly (sblip) /txt/2.txt localhost 2311 -01.3 PT_NOTE To PT_LOAD ELF Injector In Rust (d3npa) /txt/3.txt localhost 2311 -01.4 PT_NOTE Disinfector In Python (manizzle) /txt/4.txt localhost 2311 -01.5 Fuzzing Radare2 For 0days In About 30 Lines Of Code (Architect, s01den) /txt/5.txt localhost 2311 -01.6 The Polymorphic False-Disassembly Technique (s01den) /txt/6.txt localhost 2311 -01.7 Lin64.Eng3ls: Some Anti-RE Techniques In A Linux Virus (s01den, sblip) /txt/7.txt localhost 2311 -01.8 Linux.Midrashim.asm (TMZ) /txt/Linux.Midrashim.asm localhost 2311 -01.9 In-Memory LKM Loading (netspooky) /txt/9.txt localhost 2311 -01.10 Linux SHELF Loading (ulexec, Anonymous_) /txt/10.txt localhost 2311 -01.11 Return To Original Entry Point Despite PIE (s01den) /txt/11.txt localhost 2311 -01.12 Writing Viruses In MIPS Assembly For Fun (And No Profit) (s01den) /txt/12.txt localhost 2311 -01.13 Interview: herm1t (tmp.0ut Staff) /txt/13.txt localhost 2311 -01.14 GONE IN 360 SECONDS - Linux/Retaliation (qkumba) /txt/14.txt localhost 2311 -01.15 Linux.Nasty.asm (TMZ) /txt/Linux.Nasty.asm localhost 2311 -01.16 Linux.Precinct3.asm (netspooky) /txt/Linux.Precinct3.asm localhost 2311 -01.17 Underground Worlds (s01den) /txt/17.txt localhost 2311 diff --git a/polyglot-instructions.txt b/polyglot-instructions.txt deleted file mode 100644 index c618125..0000000 --- a/polyglot-instructions.txt +++ /dev/null @@ -1,38 +0,0 @@ -Dependencies: - -* go >= 1.15 -* zip - - -1.) Compile go program: - -``` -go build -``` - -if you want to make the resulting binary file smaller, you can compile with: - -``` -go build -ldflags="-s -w" -``` - -2.) Concatenate the compiled program and ZIP file: - -``` -cat gopher-server zip-file.zip > cat.zip -``` - -3.) Fix ZIP file offsets: - -``` -zip -F cat.zip --out out.zip -``` - -4.) Make polyglot file executable if you want to run the file: - -``` -chmod +x out.zip -``` - -If you want to use --port or --host flags, please make sure index.gph -file at root of ZIP file has the matching port and host information.