Skip to content

Commit

Permalink
Merge pull request #58 from sudosammy/dev
Browse files Browse the repository at this point in the history
add FULL_HTTP_REQUEST support & --help
  • Loading branch information
sudosammy authored Feb 16, 2023
2 parents a9e3bf8 + ecf02d1 commit eb25ad0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.4.2
3.4.3
1 change: 1 addition & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ If you are running Burp Collaborator on the same server as knary, you will need
* `BURP_INT_IP` __Optional__ The internal IP address that Burp Collaborator is bound to. In most cases this will be `127.0.0.1` (which is the default); however, if you run knary in Docker you may need to set this to the Burp Collaborator IP address reachable from within the knary container

## Optional Configurations
* `FULL_HTTP_REQUEST` Set to `true` to display the full request made to knary, otherwise use the default mininal set
* `TLS_*` (CRT/KEY). If you're not using the `LETS_ENCRYPT` configuration use these environment variables to configure the location of your certificate and private key for accepting TLS (HTTPS) requests. Example input `TLS_KEY=certs/knary.key`
* `DEBUG` Enable/Disable displaying incoming requests in the terminal and some additional info. Default disabled (true/false)
* `ALLOWLIST_STRICT` Set to `true` to prevent fuzzy matching on allowlist items and only alert on exact matches
Expand Down
15 changes: 11 additions & 4 deletions libknary/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,19 @@ func handleRequest(conn net.Conn) bool {
}

if cookie != "" {
msg = fmt.Sprintf("%s\n```Query: %s\n%s\n%s\nFrom: %s", host, query, userAgent, cookie, fromIP)

if os.Getenv("FULL_HTTP_REQUEST") != "" {
msg = fmt.Sprintf("%s\n```Query: %s\n%s\n%s\nFrom: %s\n\n---------- FULL REQUEST ----------\n%s\n----------------------------------", host, query, userAgent, cookie, fromIP, response)
} else {
msg = fmt.Sprintf("%s\n```Query: %s\n%s\n%s\nFrom: %s", host, query, userAgent, cookie, fromIP)
}
} else {
msg = fmt.Sprintf("%s\n```Query: %s\n%s\nFrom: %s", host, query, userAgent, fromIP)

if os.Getenv("FULL_HTTP_REQUEST") != "" {
msg = fmt.Sprintf("%s\n```Query: %s\n%s\nFrom: %s\n\n---------- FULL REQUEST ----------\n%s\n----------------------------------", host, query, userAgent, fromIP, response)
} else {
msg = fmt.Sprintf("%s\n```Query: %s\n%s\nFrom: %s", host, query, userAgent, fromIP)
}
}

go sendMsg(msg + "```")
if os.Getenv("DEBUG") == "true" {
logger("INFO", fromIP+" - "+host)
Expand Down
10 changes: 9 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/joho/godotenv"
"github.com/miekg/dns"

"flag"
"fmt"
"log"
"os"
Expand All @@ -14,12 +15,19 @@ import (
)

const (
VERSION = "3.4.2"
VERSION = "3.4.3"
GITHUB = "https://github.com/sudosammy/knary"
GITHUBVERSION = "https://raw.githubusercontent.com/sudosammy/knary/master/VERSION"
)

func main() {
var help = flag.Bool("help", false, "Show help")
flag.Parse()
if *help {
libknary.Printy("Find all configuration options and example .env files here: "+GITHUB+"/tree/master/examples", 3)
os.Exit(0)
}

// load enviro variables
err := godotenv.Load()
if os.Getenv("CANARY_DOMAIN") == "" {
Expand Down

0 comments on commit eb25ad0

Please sign in to comment.