Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/BishopFox/jsluice
/ functions
Functions
145 in github.com/BishopFox/jsluice
⨍
Functions
145
◇
Types & classes
20
↓ 33 callers
Method
ChildByFieldName
Fetches a child Node from a named field. For example, the 'pair' node has two fields: key, and value.
tree.go:67
↓ 31 callers
Method
Type
Type returns the tree-sitter type string for a Node. E.g. string, object, call_expression. If the node is nil then an empty string is returned.
tree.go:58
↓ 29 callers
Method
Content
Content returns the source code for a particular node.
tree.go:48
↓ 21 callers
Method
NamedChild
NamedChild returns the 'named' child Node at the provided index. Tree-sitter considers a child to be named if it has a name in the syntax tree. Things
tree.go:88
↓ 20 callers
Method
RawString
RawString returns the raw JavaScript representation of a string (i.e. escape sequences are left undecoded) but with the surrounding quotes removed.
tree.go:206
↓ 15 callers
Method
IsValid
IsValid returns true if the *Node and the underlying tree-sitter node are both not nil.
tree.go:199
↓ 13 callers
Method
AsMap
AsMap returns a representation of the Node as a map[string]any
tree.go:256
↓ 13 callers
Function
NewNode
NewNode creates a new Node for the provided tree-sitter node and a byte-slice containing the JavaScript source. The source provided should be the comp
tree.go:34
↓ 13 callers
Method
Parent
Parent returns the Parent Node for a Node
tree.go:324
↓ 12 callers
Method
AsObject
AsObject returns a Node as jsluice's internal object type, to allow the fetching of keys etc
tree.go:43
↓ 11 callers
Method
Contains
(item string)
set.go:13
↓ 10 callers
Method
CollapsedString
CollapsedString takes a node representing a URL and attempts to make it at least somewhat easily parseable. It's common to build URLs out of variables
tree.go:179
↓ 9 callers
Function
NewAnalyzer
NewAnalyzer accepts a slice of bytes representing some JavaScript source code and returns a pointer to a new Analyzer
analyzer.go:23
↓ 7 callers
Method
Emit
Emit adds a token of the provided type to the stringLexer's internal list of tokens. The start pointer is advanced to the current position.
strings.go:118
↓ 7 callers
Method
IsStringy
IsStringy returns true if a Node is a string or is an expression starting with a string (e.g. a string concatenation expression).
tree.go:470
↓ 6 callers
Function
DecodeString
DecodeString accepts a raw string as it might be found in some JavaScript source code, and converts any escape sequences. E.g: foo\x3dbar -> foo=bar /
strings.go:189
↓ 6 callers
Method
GetKeys
GetKeys returns a slice of all keys in an object
objects.go:85
↓ 6 callers
Method
Next
Next returns the next rune in the input string, moving the position pointer on by the size of the rune that was decoded. For ASCII text this wouldn't
strings.go:86
↓ 5 callers
Method
GetString
GetString returns the property corresponding to the provided key as a string, or the defaultVal if the key is not found.
objects.go:115
↓ 5 callers
Method
Ignore
Ignore moves the start position pointer to the current position without emitting a token; effectively ignoring the chunk of text between the last toke
strings.go:129
↓ 5 callers
Method
RootNode
RootNode returns the root note of the parsed JavaScript
analyzer.go:63
↓ 4 callers
Method
Backup
Backup moves the position pointer back by the length of the previous rune in the input string.
strings.go:99
↓ 4 callers
Method
DecodedString
DecodedString returns a fully decoded version of a JavaScript string. It is just a convenience wrapper around the DecodeString function.
tree.go:213
↓ 4 callers
Method
GetObject
GetObject returns the property corresponding to the provided key as an Object
objects.go:108
↓ 4 callers
Method
GetStringI
GetStringI is like GetString, but the key is case-insensitive
objects.go:124
↓ 4 callers
Method
GetURLs
GetURLs searches the JavaScript source code for absolute and relative URLs and returns a slice of results.
url-matchers.go:30
↓ 4 callers
Function
ParseUserPatterns
ParseUserPatterns accepts an io.Reader pointing to a JSON user-pattern definition file, and returns a list of UserPatterns, and any error that occurre
user-patterns.go:212
↓ 4 callers
Method
String
()
strings.go:27
↓ 3 callers
Method
Accept
Accept advances the position pointer only if the next rune is in the set of valid runes provided
strings.go:135
↓ 3 callers
Method
Add
Add accepts a *Node and adds it to the QueryResult, provided it has a valid CaptureName
tree.go:398
↓ 3 callers
Method
AsGoType
AsGoType returns a representation of a Node as a native Go type, defaulting to a string containing the JavaScript source for the Node. Return types ar
tree.go:230
↓ 3 callers
Method
Get
Get returns the corresponding *Node for the provided capture name, or nil if no such *Node exists
tree.go:415
↓ 3 callers
Method
GetNode
GetNode returns the matching *Node for a given key
objects.go:70
↓ 3 callers
Method
GetSecrets
GetSecrets uses the parse tree and a set of Matchers (those provided by AllSecretMatchers()) to find secrets in JavaScript source code.
secret-matchers.go:47
↓ 3 callers
Method
HasValidNode
HasValidNode returns true if the underlying node is a valid JavaScript object
objects.go:38
↓ 3 callers
Method
MatchValue
MatchValue returns true if a pattern's value regex matches the supplied value, or if there is no value regex.
user-patterns.go:64
↓ 3 callers
Function
MaybeURL
(in string)
maybeurl.go:20
↓ 3 callers
Method
NamedChildCount
NamedChildCount returns the number of named children a Node has.
tree.go:104
↓ 3 callers
Method
NamedChildren
NamedChildren returns a slice of *Node containg all named children for a node.
tree.go:125
↓ 3 callers
Method
Query
Query executes a tree-sitter query on a specific Node. Nodes captured by the query are passed one at a time to the provided callback function. See ht
tree.go:374
↓ 3 callers
Method
String
()
cmd/jsluice/main.go:60
↓ 2 callers
Method
AcceptN
AcceptN advances the position pointer N times, only if the next N runes are in the set of valid runes provided
strings.go:145
↓ 2 callers
Method
AcceptRun
AcceptRun accepts runes until encountering a rune not in the set of valid runes provided
strings.go:165
↓ 2 callers
Method
ChildCount
ChildCount returns the number of children a node has
tree.go:96
↓ 2 callers
Method
Format
Format outputs a nicely formatted version of the source code for the Node. Formatting is done by https://github.com/ditashi/jsbeautifier-go/
tree.go:363
↓ 2 callers
Method
GetNodeFunc
GetNodeFunc is a general-purpose method for finding object properties by their key. The provided function is called with each key in turn. The first t
objects.go:46
↓ 2 callers
Method
IsNamed
IsNamed returns true if the underlying node is named
tree.go:332
↓ 2 callers
Function
NewObject
NewObject returns a jsluice Object for the given Node
objects.go:16
↓ 2 callers
Method
Query
Query peforms a tree-sitter query on the JavaScript being analyzed. The provided function is called once for every node that captured by the query. Se
analyzer.go:49
↓ 2 callers
Method
Set
(value string)
cmd/jsluice/main.go:64
↓ 2 callers
Function
couldBePath
(in string)
cmd/jsurls-sinks/main.go:122
↓ 2 callers
Function
dequote
dequote removes surround quotes from the provided string
tree.go:495
↓ 2 callers
Function
dequote
(in string)
cmd/jsurls-sinks/main.go:192
↓ 2 callers
Method
get
(k *Node)
url-match-xhr.go:27
↓ 2 callers
Function
isProbablyHTML
isProbablyHTML returns true for source that is probably HTML. False positives are OK as long as the false positives are not JavaScript source.
analyzer.go:70
↓ 2 callers
Function
newSet
(items []string)
set.go:5
↓ 2 callers
Method
pairMatcher
pairMatcher returns a SecretMatcher for matching against key/value pairs
user-patterns.go:127
↓ 2 callers
Function
startsWithString
(in string)
cmd/jsurls-sinks/main.go:109
↓ 1 callers
Method
AcceptUntil
AcceptUntil accepts any runes until the rune provided is encountered
strings.go:157
↓ 1 callers
Method
AddSecretMatcher
AddSecretMatcher allows custom SecretMatchers to be added to the Analyzer
secret-matchers.go:28
↓ 1 callers
Method
AddSecretMatchers
AddSecretMatchers allows multiple custom SecretMatchers to be added to the Analyzer
secret-matchers.go:37
↓ 1 callers
Method
AddURLMatcher
AddURLMatcher allows custom URLMatchers to be added to the Analyzer
url-matchers.go:129
↓ 1 callers
Function
AllSecretMatchers
AllSecretMatchers returns the default list of SecretMatchers
secret-matchers.go:91
↓ 1 callers
Function
AllURLMatchers
AllURLMatchers returns the detault list of URLMatchers
url-matchers.go:144
↓ 1 callers
Method
AsArray
AsArray returns a representation of the Node as a []any
tree.go:279
↓ 1 callers
Method
AsNumber
AsNumber returns a representation of the Node as an int or float64. Note: hex, octal etc number formats are currently unsupported
tree.go:298
↓ 1 callers
Method
CaptureName
CaptureName returns the name given to a node in a query if one exists, and an empty string otherwise
tree.go:490
↓ 1 callers
Method
Child
Child returns the child Node at the provided index
tree.go:75
↓ 1 callers
Method
GetNodeI
GetNodeI is like GetNode, but case-insensitive
objects.go:77
↓ 1 callers
Method
Has
Has returns true if the QueryResult contains a *Node for the provided capture name
tree.go:408
↓ 1 callers
Method
MatchKey
MatchKey returns true if a pattern's key regex matches the supplied value, or if there is no key regex
user-patterns.go:73
↓ 1 callers
Function
NewQueryResult
NewQueryResult returns a QueryResult containing the provided *Nodes
tree.go:386
↓ 1 callers
Method
ParseRegex
ParseRegex parses all of the user-provided regular expressions for a pattern into Go *regexp.Regexp types
user-patterns.go:28
↓ 1 callers
Method
Peek
Peek returns the next rune in the input string without advancing the position pointer
strings.go:109
↓ 1 callers
Function
PrintTree
PrintTree returns a string representation of the syntax tree for the provided JavaScript source
tree.go:510
↓ 1 callers
Method
QueryMulti
QueryMulti executes a tree-sitter query on a specific Node. Nodes captured by the query are grouped into a QueryResult and passed to the provided call
tree.go:428
↓ 1 callers
Method
QueryMulti
Query peforms a tree-sitter query on the JavaScript being analyzed. The provided function is called for every query match, with captured nodes grouped
analyzer.go:58
↓ 1 callers
Method
SecretMatcher
SecretMatcher returns a SecretMatcher based on the UserPattern, for use with (*Analyzer).AddSecretMatcher()
user-patterns.go:82
↓ 1 callers
Method
SecretMatchers
SecretMatchers returns a slice of SecretMatcher for use with (*Analyzer).AddSecretMatchers()
user-patterns.go:200
↓ 1 callers
Method
Type
()
cmd/jsluice/main.go:69
↓ 1 callers
Function
awsMatcher
()
secret-aws.go:8
↓ 1 callers
Function
content
content returns the source for the provided tree-sitter node, checking if the node is nil first.
tree.go:501
↓ 1 callers
Function
extractInlineJS
extractInlineJS extracts inline JavaScript from HTML pages using goquery.
analyzer.go:86
↓ 1 callers
Function
firebaseMatcher
()
secret-gcp.go:51
↓ 1 callers
Function
gcpKeyMatcher
()
secret-gcp.go:8
↓ 1 callers
Function
getTree
getTree does the actual heavy lifting and recursion for PrintTree TODO: provide a way to print the tree as a JSON object?
tree.go:522
↓ 1 callers
Function
githubKeyMatcher
()
secret-github.go:7
↓ 1 callers
Function
matchJQuery
()
url-match-jquery.go:9
↓ 1 callers
Function
matchXHR
()
url-match-xhr.go:34
↓ 1 callers
Function
newNodeCache
()
url-match-xhr.go:15
↓ 1 callers
Function
newStringLexer
(in string)
strings.go:71
↓ 1 callers
Method
objectMatcher
objectMatcher returns a SecretMatcher for matching against objects
user-patterns.go:95
↓ 1 callers
Function
queryNodes
(n *sitter.Node, enter func(*sitter.Node))
cmd/jsurls-sinks/main.go:134
↓ 1 callers
Function
readFromFileOrURL
(path string, cookie string, headers []string, ignoreCert bool)
cmd/jsluice/main.go:295
↓ 1 callers
Function
readWARCFile
(filename string)
cmd/jsluice/main.go:343
↓ 1 callers
Method
set
(k *Node, v []*Node)
url-match-xhr.go:21
↓ 1 callers
Method
stringMatcher
stringMatcher returns a SecretMatcher for matching against string literals
user-patterns.go:166
↓ 1 callers
Function
unique
(items []T)
url-matchers.go:107
Method
AsMap
AsMap returns a Go map version of the object
objects.go:24
Function
BenchmarkDecodeString
(b *testing.B)
strings_test.go:53
next →
1–100 of 145, ranked by callers