8000 Merge pull request #154 from dkegel-fastly/master · codingo/NoSQLMap@5a6dc7a · GitHub
[go: up one dir, main page]

Skip to content

Commit 5a6dc7a

Browse files
authored
Merge pull request #154 from dkegel-fastly/master
Fix overeager requests update incompatible with python 2.7
2 parents 54d3fdb + 589a1ae commit 5a6dc7a

File tree

8 files changed

+54
-14
lines changed

8 files changed

+54
-14
lines changed

docker/Dockerfile renamed to Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.9/main' >> /etc/apk/repositori
44
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.9/community' >> /etc/apk/repositories
55
RUN apk update && apk add mongodb git
66

7-
RUN git clone https://github.com/codingo/NoSQLMap.git /root/NoSqlMap
8-
9-
WORKDIR /root/NoSqlMap
7+
WORKDIR /work
8+
COPY . /work
109

1110
RUN python setup.py install
1211

13-
RUN python -m pip install requests 'certifi<=2020.4.5.1'
12+
RUN python -m pip install 'requests<2.28' 'certifi<=2020.4.5.1'
1413

1514
COPY entrypoint.sh /tmp/entrypoint.sh
1615
RUN chmod +x /tmp/entrypoint.sh

README.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ There are some various other libraries required that a normal Python installatio
4646
python setup.py install
4747
```
4848

49-
Alternatively you can build a Docker image by changing to the docker directory and entering:
49+
Alternatively you can build a Docker image by entering:
5050

5151
```
5252
docker build -t nosqlmap .
@@ -102,4 +102,45 @@ This repo also includes an intentionally vulnerable web application to test NoSQ
102102
docker-compose build && docker-compose up
103103
```
104104

105-
Once that is complete, you should be able to access the vulnerable application by visiting: https://127.0.0.1/index.html
105+
Once that is complete, you should be able to access the vulnerable application by visiting: https://127.0.0.1:8080/index.html
106+
107+
## Scripting
108+
109+
The cli can also be scripted. Here's an example script using NoSQLMap to detect the vulnerabilities in vuln_apps:
110+
111+
```
112+
$ echo "1. Account Lookup (acct.php)"
113+
$ docker-compose run --remove-orphans nosqlmap \
114+
--attack 2 \
115+
--victim host.docker.internal \
116+
--webPort 8080 \
117+
--uri "/acct.php?acctid=test" \
118+
--httpMethod GET \
119+
--params 1 \
120+
--injectSize 4 \
121+
--injectFormat 2 \
122+
--doTimeAttack n
123+
124+
$ echo "2. User Data Lookup (userdata.php) - JavaScript Injection"
125+
$ docker-compose run --remove-orphans nosqlmap \
126+
--attack 2 \
127+
--victim host.docker.internal \
128+
--webPort 8080 \
129+
--uri "/userdata.php?usersearch=test" \
130+
--httpMethod GET \
131+
--params 1 \
132+
--injectSize 4 \
133+
--injectFormat 2 \
134+
--doTimeAttack n
135+
136+
$ echo "3. Order Data Lookup (orderdata.php) - JavaScript Injection"
137+
$ docker-compose run --remove-orphans nosqlmap \
138+
--attack 2 \
139+
--victim host.docker.internal \
140+
--webPort 8080 \
141+
--uri "/orderdata.php?ordersearch=test" \
142+
--httpMethod GET \
143+
--params 1 \
144+
--injectSize 4 \
145+
--injectFormat 2 \
146+
--doTimeAttack n

docker/entrypoint.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

entrypoint.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/ash
2+
python nosqlmap.py "$@"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
install_requires = [ "CouchDB==1.0", "httplib2==0.19.0", "ipcalc==1.1.3",\
1818
"NoSQLMap==0.7", "pbkdf2==1.3", "pymongo==2.7.2",\
19-
"requests==2.32.4"],
19+
"requests<2.28"],
2020

2121
author = "tcstool",
2222
author_email = "codingo@protonmail.com",

vuln_apps/docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ services:
66
links:
77
- php
88
ports:
9-
- "80:80"
9+
- "${NOSQLMAP_VULN_APPS_APACHE_PORT:-8080}:80"
1010
volumes:
1111
- ./src:/usr/local/apache2/htdocs
1212
php:
1313
container_name: php
1414
build: ./docker/php
1515
ports:
16-
- "9000:9000"
16+
- "${NOSQLMAP_VULN_APPS_PHP_PORT:-9000}:9000"
1717
volumes:
1818
- ./src:/usr/local/apache2/htdocs
1919
working_dir: /usr/local/apache2/htdocs
@@ -24,4 +24,4 @@ services:
2424
MONGO_INITDB_ROOT_PASSWORD: prisma
2525
build: ./docker/mongo
2626
ports:
27-
- "27017:27017"
27+
- "${NOSQLMAP_VULN_APPS_MONGO_PORT:-27017}:27017"

vuln_apps/src/userdata.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
$conn = new MongoClient('mongodb://127.0.0.1');
1212
$db = $conn->appUserData;
1313
$collection = $db->users;
14-
$search = $_GET['usersearch'];
14+
$usersearch = $_GET['usersearch'];
1515
$js = "function () { var query = '". $usersearch . "'; return this.username == query;}";
1616
print $js;
1717
print '<br/>';
@@ -45,4 +45,4 @@
4545
<?php echo $result; ?>
4646
</div>
4747
</body>
48-
</html>
48+
</html>

0 commit comments

Comments
 (0)
0