Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion C#/obj/Debug/net8.0/c2.AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("c2")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0d4214d8d957a44663e1f74da0bdea0972a27726")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+25af4e3c57f5abb8d44bfbea227fbb54cf05b8ba")]
[assembly: System.Reflection.AssemblyProductAttribute("c2")]
[assembly: System.Reflection.AssemblyTitleAttribute("c2")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Expand Down
2 changes: 1 addition & 1 deletion C#/obj/Debug/net8.0/c2.AssemblyInfoInputs.cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e42c94a693dd68ab4e838e9363900efb3eabd2d7217a54e4c2aa5e9f95858206
36a662ff3cfb3e1f65da1c94942d2800c393361abfd38b1cb1a61b0fb99a1e08
22 changes: 11 additions & 11 deletions python/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ def created(self, obj):
return obj.timestamp.strftime('%Y-%m-%d %H:%M:%S')
created.short_description = 'Created'

def user_url(self, obj):
if obj.actor:
app_label, model = settings.AUTH_USER_MODEL.split('.')
viewname = 'admin:%s_%s_change' % (app_label, model.lower())
try:
link = urlresolvers.reverse(viewname, args=[obj.actor.id])
except NoReverseMatch:
return u'%s' % (obj.actor)
return format_html(u'<a href="{}">{}</a>', link, obj.actor)

return 'system'
# def user_url(self, obj):
# if obj.actor:
# app_label, model = settings.AUTH_USER_MODEL.split('.')
# viewname = 'admin:%s_%s_change' % (app_label, model.lower())
# try:
# link = urlresolvers.reverse(viewname, args=[obj.actor.id])
# except NoReverseMatch:
# return u'%s' % (obj.actor)
# return format_html(u'<a href="{}">{}</a>', link, obj.actor)

# return 'system'
user_url.short_description = 'User'

def msg_short(self, obj):
Expand Down
14 changes: 7 additions & 7 deletions python/p1.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Vulnerability 1: SQL Injection (CWE-89)
def get_user(username):
import sqlite3
conn = sqlite3.connect('users.db')
cursor = conn.cursor()
query = "SELECT * FROM users WHERE username = '" + username + "'" # SQLi
cursor.execute(query)
return cursor.fetchall()
# def get_user(username):
# import sqlite3
# conn = sqlite3.connect('users.db')
# cursor = conn.cursor()
# query = "SELECT * FROM users WHERE username = '" + username + "'" # SQLi
# cursor.execute(query)
# return cursor.fetchall()

# Vulnerability 2: Command Injection (CWE-78)
def ping_host(host):
Expand Down