Skip to content

Commit cc4fa55

Browse files
committed
Fix overeager requests update incompatible with python 2.7
Python 2.7 was very sad with dependabot's change. Fixed! Also three docker improvements: - Make development easier with docker by using the files from the current directory instead of checking out a fresh copy. This clutters the top level directory a bit, but it feels like a good tradeoff. - Have the docker app listen on port 8080 by default, as fiddling with port 80 is a bit scary - Have the docker app accept commandline parameters And, finally, a README.md improvement: - Show an example script to tickle three vulnerabilities in vuln_apps
1 parent 54d3fdb commit cc4fa55

File tree

7 files changed

+50
-10
lines changed

7 files changed

+50
-10
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
links:
77
- php
88
ports:
9-
- "80:80"
9+
- "8080:80"
1010
volumes:
1111
- ./src:/usr/local/apache2/htdocs
1212
php:

0 commit comments

Comments
 (0)