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
46 changes: 46 additions & 0 deletions py_error_20195924015930.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#import lxml

class C20195924015930():
"This is an example class"
a = 10
@classmethod
def funct(self):
print('Hello Example')

# Output: 10
print(C20195924015930.a)

# Output: <function MyClass.func at 0x0000000003079BF8>
print(C20195924015930.func)

# Output: 'This is my second class'
print(C20195924015930.__doc__)

# Code Injection
def GET(self):
get_input = web.input()
param1 = get_input['param1'] if 'param1' in get_input else None
if (param1):
x = ast.literal_eval(param1)
return "I'm not vulnerable"+x

# CWE-759
def storePassword(userName,Password):
hasher = hashlib.new('md5')
hasher.update(Password)
hashedPassword = hasher.digest()

# UpdateUserLogin returns True on success, False otherwise
return updateUserLogin(userName,hashedPassword)

def calc(number,times):
print("Sum =", a+b)
#no need for exec
for x in range(0, 3):
print("We're on time %d" % (x))
y = 1
while True:
if(y%2 ==0):
print("To infinity and beyond! We're getting close, on %d now!" % (y))
y += 1
return number*times
15 changes: 15 additions & 0 deletions py_unittest_20195924015930.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from django.test import TestCase


from py_error_20195924015930 import C20195924015930

class TestModel01(TestCase):

def test_01(self):
x = C20195924015930()
self.assertIs(x.a,10)


def test_02(self):
x = C20195924015930()
self.assertIs(x.calc(7,3),21)
11 changes: 11 additions & 0 deletions py_xss_20195924015930.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from flask import Flask, request, make_response, escape

app = Flask(__name__)
@app.route('/unsafe')
def unsafe():
first_name = request.args.get('name', '')
return make_response("Your name is " + first_name)
@app.route('/safe')
def safe():
first_name = request.args.get('name', '')
return make_response("Your name is " + escape(first_name))
10 changes: 10 additions & 0 deletions static/js/js_error_20195924015930.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function hello() {
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let a = "dummy"
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return "Hello";
}

function world() {
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

password a = "dummy"
let b = "line"
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return "World";
}