Skip to content

Commit e2c8e02

Browse files
committed
feat: major bump, fix mfa
1 parent 4880efc commit e2c8e02

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1001609
-165
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,3 @@ jobs:
3131
sed -E 's/.*"v([^"]+)".*/\1/' \
3232
)
3333
docker run --rm goodwithtech/dockle:v${DOCKLE_LATEST} benno001/problematic-project:latest
34-

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks.git
3+
rev: v5.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: check-merge-conflict
7+
- id: check-yaml
8+
- id: end-of-file-fixer

Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
FROM python:3.7-buster
1+
FROM python:3.14
22

3-
RUN apt-get update -y
4-
RUN apt-get upgrade -y
3+
RUN apt-get update
54
RUN apt-get install -y build-essential
65

76
WORKDIR /usr/src/app
@@ -14,6 +13,6 @@ COPY . .
1413

1514
RUN "python" "db_init.py"
1615

17-
EXPOSE 5000
16+
EXPOSE 8080
1817

19-
CMD [ "python", "./vulpy.py" ]
18+
CMD [ "python", "./vulpy.py" ]

Dockerfile-improved

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.7-alpine3.11
1+
FROM python:3.14-alpine
22

33
RUN apk update && apk add gcc musl-dev python3-dev libffi-dev openssl-dev --no-cache
44

@@ -18,6 +18,6 @@ RUN "python" "db_init.py"
1818

1919
USER nobody
2020

21-
EXPOSE 5000
21+
EXPOSE 8080
2222

23-
CMD [ "python", "./vulpy.py" ]
23+
CMD [ "python", "./vulpy.py" ]

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2121
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2222
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2323
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24-
SOFTWARE.
24+
SOFTWARE.

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,12 @@ Contains bad Python code with weak configuration settings, a sub-standard Docker
55
_**Don't run this thing in production.**_ 🙄
66

77
Based on the vulnerable Python webapp [Vulpy](https://github.com/fportantier/vulpy/) created by F. Portantier.
8+
9+
## Installing dependencies
10+
11+
`uv sync`
12+
13+
## Running the application
14+
15+
1. `uv run python db_init.py`
16+
2. `uv run python ./vulpy.py`

brute.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,3 @@
2222
if result.returncode == 0:
2323
print("cracked! user: {} password: {}".format(username, password))
2424
break
25-

csp.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
#img-src 'self' https://www.python.org;
1414

1515
#style-src 'self';
16-
#style-src 'self' 'unsafe-inline';
16+
#style-src 'self' 'unsafe-inline';
1717

1818
#style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
1919
#font-src https://fonts.gstatic.com;
20-

db.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,3 @@ def db_init():
2424

2525
if __name__ == '__main__':
2626
db_init()
27-

db_init.py

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,52 @@
44
import sqlite3
55

66

7-
def db_init_users():
7+
def set_wal_mode(db_path):
8+
conn = sqlite3.connect(db_path)
9+
conn.execute("PRAGMA journal_mode=WAL")
10+
conn.close()
811

9-
users = [
10-
('admin', 'SuperSecret'),
11-
('elliot', '123123123'),
12-
('tim', '12345678')
13-
]
1412

15-
conn = sqlite3.connect('db_users.sqlite')
13+
def db_init_users():
14+
db_path = "db_users.sqlite"
15+
users = [("admin", "SuperSecret"), ("elliot", "123123123"), ("tim", "12345678")]
16+
set_wal_mode(db_path)
17+
conn = sqlite3.connect(db_path)
1618
c = conn.cursor()
17-
c.execute("CREATE TABLE users (username text, password text, failures int, mfa_enabled int, mfa_secret text)")
19+
c.execute(
20+
"CREATE TABLE users (username text, password text, failures int, mfa_enabled int, mfa_secret text)"
21+
)
1822

19-
for u,p in users:
20-
c.execute("INSERT INTO users (username, password, failures, mfa_enabled, mfa_secret) VALUES ('%s', '%s', '%d', '%d', '%s')" %(u, p, 0, 0, ''))
23+
for u, p in users:
24+
c.execute(
25+
"INSERT INTO users (username, password, failures, mfa_enabled, mfa_secret) VALUES ('%s', '%s', '%d', '%d', '%s')"
26+
% (u, p, 0, 0, "")
27+
)
2128

2229
conn.commit()
2330
conn.close()
2431

2532

2633
def db_init_posts():
27-
28-
conn = sqlite3.connect('db_posts.sqlite')
34+
db_path = "db_posts.sqlite"
35+
set_wal_mode(db_path)
36+
conn = sqlite3.connect(db_path)
2937
c = conn.cursor()
3038
c.execute("CREATE TABLE posts (date date, username text, text text)")
3139

3240
conn.commit()
3341
conn.close()
3442

3543

36-
if __name__ == '__main__':
37-
44+
if __name__ == "__main__":
3845
try:
39-
os.remove('db_users.sqlite')
46+
os.remove("db_users.sqlite")
4047
except FileNotFoundError:
4148
pass
4249

4350
try:
44-
os.remove('db_posts.sqlite')
51+
os.remove("db_posts.sqlite")
4552
except FileNotFoundError:
4653
pass
47-
4854
db_init_users()
4955
db_init_posts()
50-

0 commit comments

Comments
 (0)