diff --git a/.gitignore b/.gitignore index ac76687..feafe52 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ __debug_bin* .vscode .coverage +result diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..f431822 --- /dev/null +++ b/default.nix @@ -0,0 +1,16 @@ +{ pkgs ? import { } }: + +pkgs.buildGoModule { + pname = "wormspace"; + version = "1.0.0"; + + src = pkgs.lib.cleanSource ./.; + + vendorHash = "sha256-p0W/ubYYbIpmq7D7AN6CIF421nnURbZUX5rGAkbmwiI="; + + + meta = { + description = "XSS Worm demo"; + homepage = "https://tea.filefighter.de/qvalentin/wormspace"; + }; +} diff --git a/main.go b/main.go index b35ac08..3954fbf 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,8 @@ import ( "bytes" "database/sql" "fmt" + "os" + "strconv" "strings" "unicode" @@ -229,6 +231,7 @@ func profilePage(w http.ResponseWriter, r *http.Request) { tmpl := template.Must(template.New("profile").Parse(` + @@ -259,6 +262,7 @@ func homePage(w http.ResponseWriter, r *http.Request) { tmpl := template.Must(template.New("home").Parse(` + @@ -276,6 +280,7 @@ func homePage(w http.ResponseWriter, r *http.Request) { func indexPage(w http.ResponseWriter, r *http.Request) { tmpl := template.Must(template.New("index").Parse(` +

Welcome to Wormspace

@@ -294,5 +299,13 @@ func main() { http.HandleFunc("/addpost", addPost) http.HandleFunc("/addhero", addHero) - http.ListenAndServe(":8080", nil) + port := 8080 + + // get port from arg + if len(os.Args) > 1 { + port, _ = strconv.Atoi(os.Args[1]) + } + + fmt.Println("Listening on http://localhost:" + strconv.Itoa(port)) + http.ListenAndServe(":"+strconv.Itoa(port), nil) } diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..539d70a --- /dev/null +++ b/readme.md @@ -0,0 +1,3 @@ +# XSS-Wormdemo based on "The MySpace Worm" + +https://samy.pl/myspace/tech.html