forked from ronhadad22/GitProjectNew
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
186 lines (112 loc) · 3.88 KB
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#!/bin/bash
set -ex
# conflict
git checkout main
echo '''from flask import Flask, send_file, request
app = Flask(__name__)
@app.route("/")
def home():
return "Welcome to my web server!"
@app.route("/status")
def home():
return "OK"
@app.route("/blog")
def blog():
return "Check out my latest blog post at example.com/blog."
@app.route("/pricing")
def pricing():
return "Our pricing for web development starts at $50 per hour."
@app.route("/contact")
def contact():
return "You can contact us at contact@example.com or info@example.com."
@app.route("/chat")
def contact():
return "You can chat with live agent!"
if __name__ == "__main__":
app.run(debug=True, port=8080, host="0.0.0.0")
''' > app.py
git add app.py && git -c user.name='You' -c user.email='you@company.com' commit -m "initial app.py"
git checkout -b feature/version1
echo '''from flask import Flask, send_file, request
app = Flask(__name__)
@app.route("/")
def home():
return "Welcome to my web server!"
@app.route("/status")
def home():
return "OK"
@app.route("/blog")
def blog():
return "Check out my latest blog post at example.com/blog."
@app.route("/pricing")
def pricing():
return "Our pricing for web development starts at $55 per hour."
@app.route("/contact")
def contact():
return "You can contact us at contact@example.com or info@example.com."
@app.route("/chat")
def contact():
return "You can chat with live agent!"
@app.route("/services")
def services():
return "We offer the following services: web development, data analysis, SEO."
if __name__ == "__main__":
app.run(debug=True, port=8081, host="0.0.0.0")
''' > app.py
git add app.py && git -c user.name='John Doe' -c user.email='john.doe@microsoft.com' commit -m "Restrict the extensions that can be disabled"
git checkout main
git checkout -b feature/version2
echo '''from flask import Flask, send_file, request
app = Flask(__name__)
@app.route("/")
def home():
return "Welcome to my web server!"
@app.route("/status")
def home():
return "OK"
@app.route("/blog")
def blog():
return "Check out my latest blog post at example.com/blog."
@app.route("/pricing")
def pricing():
return "Our pricing for web development starts at $70 per hour."
@app.route("/contact")
def contact():
return "You can contact us at contact@example.com or info@example.com."
@app.route("/chat")
def contact():
return "You can chat with live agent!"
@app.route("/internal")
def home():
return "System management portal"
if __name__ == "__main__":
app.run(debug=True, port=22, host="0.0.0.0")
''' > app.py
git add app.py && git -c user.name='Narayan Nadella' -c user.email='narayan.nadella@microsoft.com' commit -m "Nayaran's changes for app.py"
# vulnerable commit
BRANCHES=("bugfix/fix_readme_typo" "feature/upgrade_angular_version" "feature/data_retention_policy" "feature/elasticsearch_helm_chart" "bugfix/open_kibana_port")
for b in "${BRANCHES[@]}"
do
git branch "$b"
done
B=${BRANCHES[ $RANDOM % ${#BRANCHES[@]} ]}
git checkout $B
echo some_file | md5sum | cut -d' ' -f1 > some_file
git add some_file && git commit -m "somefile"
echo some_other_file | md5sum | cut -d' ' -f1 > some_other_file
git add some_other_file && git commit -m "some_other_file"
git rev-parse --short HEAD > test/vul_hash-1
date > testa
echo "AWS_ACCESS_KEY_ID=AKIA2GMYABLLBID7DVUP" >> testa
echo "AWS_SECRET_ACCESS_KEY=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" >> testa
git add testa
git commit -m "test working with AWS"
T_HASH=$(git rev-parse --short HEAD | md5sum | cut -d' ' -f1)
echo $T_HASH > test/vul_hash
echo some_file2 | md5sum | cut -d' ' -f1 > some_file2
git add some_file2 && git commit -m "somefile2"
echo some_other_file2 | md5sum | cut -d' ' -f1 > some_other_file2
git add some_other_file2 && git commit -m "some_other_file2"
git checkout main
git add test/vul_hash-1 test/vul_hash
git commit -m "start here"