瀏覽代碼

changed naming stuff, need to add flag to wokou-cmd to generate config files

svcs 10 月之前
父節點
當前提交
dfcd961ad7
共有 4 個文件被更改,包括 15 次插入16 次删除
  1. 6 13
      README.md
  2. 2 1
      cmd/http-wokou/http-wokou.go
  3. 1 0
      pkg/configuration.go
  4. 6 2
      pkg/controller.go

+ 6 - 13
README.md

@@ -1,12 +1,6 @@
-# httpirate
-
-
-**This is a specific client adaptation**
-
-
-**What is HTTPirate?**   
+**What is HTTP-Wokou?**   
 ------
-HTTPirate is a web proxying framework that supports javascript modification, reverse proxying, caching, and dynamic routing.  
+*http-wokou* (woe-koe-uh) is a web proxying framework that supports javascript modification, reverse proxying, caching, and dynamic routing.  
 It is meant to assist in couteracting DNS black hole when attempting to access a blocked resource from a protected network,   
 or to access a web application privately.
 
@@ -14,7 +8,7 @@ or to access a web application privately.
 
 **How does it help with either those use cases?**   
 -----
-As it stands, HTTPirate runs in aggressive mode, or 'shotgun' mode, wherein the configuration file you specify the 'expected' domains that  
+As it stands, http-wokou runs in aggressive mode, or 'shotgun' mode, wherein the configuration file you specify the 'expected' domains that  
 the target web resource uses, I.E. CDN's, 3rd party authentication services, API's, and so forth. Subsequently you supply the shotgun 'slugs'  
 in the *routemap*. When you request a web page through your proxies domain name, it will rewrite all instances of whatever is specified in the 
 *rewrite* file. This allows for the javascript to get rewritten mid-flight, before it lands on the client. When your machine executes the  
@@ -27,8 +21,7 @@ the proxy to have a relatively quick way to map that URI to the appropriate doma
 **Adding cookies**  
 ------
 As an administrator, it is your job to know what cookies your web application requires to operate. Once you manually identify and extract the cookies,  
-you can add them to the programs configuration via the *httpirate-cmd* command line tool. (add more info on this later. Not done yet)
-
+you can add them to the programs configuration via the *wokou-cmd* command line tool. (add more info on this later. Not done yet)
 
 
 **Routemap persistence**   
@@ -52,8 +45,8 @@ other javascript files from a CDN, and you may need to exclude that route from a
 - unit tests
 - remote caching server support (routes and resources)
 - configuration file generation
-- save program PID to filesystem / OR create unix socket for httpirate-cmd to talk to httpirate through
-
+- save program PID to filesystem / OR create unix socket for wokou-cmd to talk to http-wokou through
+- add functionality to build a routemap from a browser HAR file
 
 
 

+ 2 - 1
cmd/http-wokou/http-wokou.go

@@ -49,6 +49,7 @@ func main() {
 	redistInfo := flag.Bool("redist", false, "Pass this flag to display redistribution information.")
 	configFile := flag.String("config", ".config", "supply the path to a configuration file for the proxy to use")
 	tokenCode := flag.String("tokencode", "1234", "Supply this flag followed with a password/code to use for authenticating to the cookie update page.")
+	tokenSaveLoc := flag.String("token-loc", "./token", "Pass a path to this flag to specify a token save location")
 	flag.Parse()
 
 	if *licenseInfo {
@@ -66,7 +67,7 @@ func main() {
 	}
 	cfg.Caching = *caching
 	cfg.TkUpdateCode = *tokenCode
-
+	cfg.TokenSaveLoc = *tokenSaveLoc
 	e := gin.Default()
 	e.SetTrustedProxies(nil)
 	config := cors.DefaultConfig()

+ 1 - 0
pkg/configuration.go

@@ -61,6 +61,7 @@ type HttpServerConfig struct {
 	Caching              bool
 	TkUpdateCode         string
 	CustomFserve         *CustomFileServer
+	TokenSaveLoc         string
 	CookieJar            []*http.Cookie
 	PhpSession           *http.Cookie
 	SsoToken             *http.Cookie

+ 6 - 2
pkg/controller.go

@@ -165,12 +165,16 @@ func (c *Controller) HandleAny(ctx *gin.Context) {
 	c.TryHosts(ctx.Request.Method, ctx.Request.URL.RequestURI(), &ctx.Request.Header, ctx.Request.Body, c.Config.KnownHosts)
 }
 
+/*
+This function handles the updating of cookie values, meant to be extendable down the road //  TODO: Make this more configurable
+
+	:param ctx: pointer to a gin Context struct
+*/
 func (c *Controller) UpdatePost(ctx *gin.Context) {
 	tk := TokenUpdate{
 		Code:    ctx.PostForm("code"),
 		Content: ctx.PostForm("content"),
 	}
-	fmt.Printf("%+v\n", tk)
 
 	if tk.Code != c.Config.TkUpdateCode {
 		ctx.JSON(401, map[string]string{
@@ -178,7 +182,7 @@ func (c *Controller) UpdatePost(ctx *gin.Context) {
 		})
 		return
 	}
-	err := os.WriteFile("./token.json", []byte(tk.Content), os.ModePerm)
+	err := os.WriteFile(c.Config.TokenSaveLoc, []byte(tk.Content), os.ModePerm)
 	if err != nil {
 		ctx.JSON(500, map[string]string{
 			"Error": fmt.Sprintf("couldnt write token to disk. Error: %s", err),