diff --git a/src/rhosts.go b/src/rhosts.go index 45f490f..a3bc0eb 100644 --- a/src/rhosts.go +++ b/src/rhosts.go @@ -31,7 +31,11 @@ import ( "time" "fmt" sysos "jbreich/rhosts/sys" + "jbreich/rhosts/serve" ) + +var Exit chan bool + // siteList holds the location of all the sites along with a list of their location type siteList struct { location string @@ -147,6 +151,8 @@ func main() { break } } + serve.Start("blank") + <- Exit } diff --git a/src/serve/serve.go b/src/serve/serve.go new file mode 100644 index 0000000..83a887a --- /dev/null +++ b/src/serve/serve.go @@ -0,0 +1,25 @@ +// Provides the web server for rhosts to relay altered content +package serve + +import( + "net/http" +) + +func Start(certLoc string) { + go httpServer() + //go httpsServer(&certLoc) + +} + +func httpServer() (err error){ + err = http.ListenAndServe("127.0.0.1:80",http.HandlerFunc(httpHandler)) + return +} +func httpsServer(certLoc *string) (err error){ + err = http.ListenAndServeTLS("127.0.0.1:80",*certLoc + "ca.crt", *certLoc + "ca.key",http.HandlerFunc(httpHandler)) + return +} + +func httpHandler(w http.ResponseWriter, r *http.Request) { + http.Error(w,"Test",200) +}