-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen_yml.py
108 lines (89 loc) · 3.08 KB
/
gen_yml.py
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
binary = 'MonsterHunterRise.exe'
url = 'http://storage.live.com/items/207D308974C1AE6B!219969:/MonsterHunterRise.exe?authkey=AJkvzg0zYsQ5QxA'
header = "name: Analyse Binary\non:\n workflow_dispatch:\n push:\n\n"
env = "env:\n binary: {}\n url: {}\n\n".format(binary, url)
job_header = "jobs:\n"
job_base = """ analyse:
name: Analyse Binary
runs-on: ubuntu-22.04
steps:
- name: Update and Upgrade
run: |
sudo apt update
sudo apt upgrade -y
sudo apt install -y zstd curl wget
- name: Checkout
uses: actions/checkout@v3
with:
lfs: true
- name: Download Binary
run: |
curl -L ${{ env.url }} -o ${{ env.binary }}
ls -alh
- name: start docker and analyse
run: |
chmod +x analysis.sh
ls -alh
docker run --rm --env BINARY=${{ env.binary }} --name ida-docker -p 8080:8080 -v ${{ github.workspace }}:/root/host nyamisty/docker-wine-ida:7.5sp3 /root/host/analysis.sh
- name: Print Log
run: |
ls -la
cat ida_log
- name: Prepare Artifact
run: |
tar -cvf - ${{ env.binary }}* ida_log | zstd - -o ${{ env.binary }}.tar.zst
- name: Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.binary }}_0
path: ${{ env.binary }}.tar.zst
"""
job_continue = []
for i in range(35*24//6 - 1):
# for i in range(6):
job_i = """
analyse_continue_{}:
needs: analyse{}
name: Analyse Binary Continue {}
runs-on: ubuntu-22.04
steps:
- name: Update and Upgrade
run: |
sudo apt update
sudo apt upgrade -y
sudo apt install -y zstd
- name: Checkout
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: ${{{{ env.binary }}}}_{}
- name: Prepare_download Artifact
run: |
zstd -d ${{{{ env.binary }}}}.tar.zst -c | tar xf -
- name: Check if already completed
run: |
if [ "$(cat ida_log | grep "The initial autoanalysis has been finished.")" ]; then
echo "[+] Already completed! Exit"
exit 1
fi
- name: start docker and analyse
run: |
chmod +x analysis.sh
ls -alh
docker run --rm --env BINARY=${{{{ env.binary }}}} --name ida-docker -p 8080:8080 -v ${{{{ github.workspace }}}}:/root/host nyamisty/docker-wine-ida:7.5sp3 /root/host/analysis.sh
- name: Print Log
run: |
ls -la
cat ida_log
- name: Prepare Artifact
run: |
rm -rf ${{{{ env.binary }}}}.tar.zst
tar -cvf - ${{{{ env.binary }}}}* ida_log | zstd - -o ${{{{ env.binary }}}}.tar.zst
- name: Artifact
uses: actions/upload-artifact@v3
with:
name: ${{{{ env.binary }}}}_{}
path: ${{{{ env.binary }}}}.tar.zst
""".format(i+1, "" if i == 0 else "_continue_" + str(i), i+1, i, i+1)
job_continue.append(job_i)
print(''.join([header, env, job_header, job_base] + job_continue))