Upload 4 files
Browse files- OriAsmFile.zip +3 -0
- genDataset.py +42 -0
- json-TestData.txt +1 -0
- jsonDataSet.zip +3 -0
OriAsmFile.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7a7d1e19abdbff9dde8f3ccfbc9e19f1f8c589346c955050338e18a44b049e27
|
3 |
+
size 75118950
|
genDataset.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import re
|
2 |
+
normfile = '/home/lucky/experiments/dataset/NormAsmFile/newffmpegasm.txt'
|
3 |
+
|
4 |
+
#dataset = [{Function:"",Code:[{PLcode:"",ASMcode:""}]}]
|
5 |
+
dataset =[]
|
6 |
+
data = {'Function':"aa",'Code':[{'PLcode':"a",'ASMcode':"d"}]}
|
7 |
+
dataset.append(data)
|
8 |
+
|
9 |
+
def gendataset(line,lines):
|
10 |
+
print('=========================')
|
11 |
+
#{'Function':"",'Code':[{'PLcode':"",'ASMcode':""}]}
|
12 |
+
data = {'Function':"",'Code':[]}
|
13 |
+
data['Function'] = re.findall('<.*>',line)[0]
|
14 |
+
line_num = lines.index(line)
|
15 |
+
|
16 |
+
while True:
|
17 |
+
line_num += 1
|
18 |
+
Code = {'PLcode':"",'ASMcode':""}
|
19 |
+
while True:
|
20 |
+
if (line_num == len(lines)-1) or ('>:' in lines[line_num+1]):
|
21 |
+
break
|
22 |
+
if '\t' in lines[line_num]:
|
23 |
+
Code['ASMcode'] += lines[line_num]
|
24 |
+
if (line_num == len(lines)-1) or ('\t' not in lines[line_num+1]):
|
25 |
+
break
|
26 |
+
else:
|
27 |
+
line_num += 1
|
28 |
+
else:
|
29 |
+
Code['PLcode'] += lines[line_num]
|
30 |
+
line_num += 1
|
31 |
+
data['Code'].append(Code)
|
32 |
+
if (line_num == len(lines)-1) or ('>:' in lines[line_num+1]):
|
33 |
+
break
|
34 |
+
print(data)
|
35 |
+
|
36 |
+
with open(normfile,'+r') as file:
|
37 |
+
lines = file.readlines()
|
38 |
+
for line in lines:
|
39 |
+
if '>:' in line:
|
40 |
+
gendataset(line,lines)
|
41 |
+
#functionname = re.findall('<.*>',temp)
|
42 |
+
|
json-TestData.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
[{"Function": "<alpn2alpnid>", "Code": [{"PLcode": "{\n", "ASMcode": "\tpush rbx\n\tmov rbx,rdi\n"}, {"PLcode": " if(strcasecompare(name, \"h1\"))\n", "ASMcode": "\tcall fb40 <curl_strequal@plt>\n\ttest eax,eax\n\tjne fdf4 <alpn2alpnid+0x41>\n"}, {"PLcode": " if(strcasecompare(name, \"h2\"))\n", "ASMcode": "\tmov rdi,rbx\n\tcall fb40 <curl_strequal@plt>\n\ttest eax,eax\n\tjne fdfb <alpn2alpnid+0x48>\n"}, {"PLcode": " if(strcasecompare(name, H3VERSION))\n", "ASMcode": "\tmov rdi,rbx\n\tcall fb40 <curl_strequal@plt>\n\ttest eax,eax\n\tje fdf9 <alpn2alpnid+0x46>\n"}, {"PLcode": " return ALPN_h3;\n", "ASMcode": "\tmov eax,0x20\n\tjmp fdf9 <alpn2alpnid+0x46>\n"}, {"PLcode": " return ALPN_h1;\n", "ASMcode": "\tmov eax,0x8\n"}, {"PLcode": "}\n", "ASMcode": "\tpop rbx\n\tret \n"}, {"PLcode": " return ALPN_h2;\n", "ASMcode": "\tmov eax,0x10\n\tjmp fdf9 <alpn2alpnid+0x46>\n"}, {"PLcode": "", "ASMcode": ""}]}, {"Function": "<altsvc_createid>", "Code": [{"PLcode": " const char *dsthost,\n enum alpnid srcalpnid,\n enum alpnid dstalpnid,\n unsigned int srcport,\n unsigned int dstport)\n{\n", "ASMcode": "\tpush r15\n\tpush r14\n\tpush r13\n\tpush r12\n\tpush rbp\n\tpush rbx\n\tsub rsp,0x18\n\tmov r12,rdi\n\tmov r13,rsi\n\tmov r15d,edx\n\tmov r14d,ecx\n\tmov DWORD PTR [rsp+0x8],r8d\n\tmov DWORD PTR [rsp+0xc],r9d\n"}, {"PLcode": " struct altsvc *as = calloc(1, sizeof(struct altsvc));\n", "ASMcode": "\tmov esi,0x48\n\tmov edi,0x1\n\tcall QWORD PTR [rax]\n\tmov rbp,rax\n"}, {"PLcode": " size_t hlen;\n size_t dlen;\n if(!as)\n", "ASMcode": "\ttest rax,rax\n\tje fef5 <altsvc_createid+0xf3>\n"}, {"PLcode": " return NULL;\n hlen = strlen(srchost);\n", "ASMcode": "\tmov rbx,0xffffffffffffffff\n\tmov eax,0x0\n\tmov rcx,rbx\n\tmov rdi,r12\n\trepnz scas al,BYTE PTR es:[rdi]\n\tmov rdx,rcx\n\tnot rdx\n"}, {"PLcode": " dlen = strlen(dsthost);\n", "ASMcode": "\tmov rcx,rbx\n\tmov rdi,r13\n\trepnz scas al,BYTE PTR es:[rdi]\n\tnot rcx\n"}, {"PLcode": " DEBUGASSERT(hlen);\n DEBUGASSERT(dlen);\n if(!hlen || !dlen)\n", "ASMcode": "\tsub rdx,0x1\n\tsete sil\n\tmov rbx,rcx\n\tsub rbx,0x1\n\tsete al\n\tor sil,al\n\tjne ff2a <altsvc_createid+0x128>\n"}, {"PLcode": " \n return NULL;\n if((hlen > 2) && srchost[0] == '[') {\n", "ASMcode": "\tcmp rdx,0x2\n\tjbe fe92 <altsvc_createid+0x90>\n\tcmp BYTE PTR [r12],0x5b\n\tje ff07 <altsvc_createid+0x105>\n"}, {"PLcode": " \n srchost++;\n hlen -= 2;\n }\n else if(srchost[hlen - 1] == '.')\n", "ASMcode": "\tlea rsi,[rdx-0x1]\n\tcmp BYTE PTR [r12+rdx*1-0x1],0x2e\n\tje fea1 <altsvc_createid+0x9f>\n"}, {"PLcode": " hlen = strlen(srchost);\n", "ASMcode": "\tmov rsi,rdx\n"}, {"PLcode": " \n hlen--;\n if((dlen > 2) && dsthost[0] == '[') {\n", "ASMcode": "\tcmp rbx,0x2\n\tjbe feae <altsvc_createid+0xac>\n\tcmp BYTE PTR [r13+0x0],0x5b\n\tje ff11 <altsvc_createid+0x10f>\n"}, {"PLcode": " \n dsthost++;\n dlen -= 2;\n }\n\n as->src.host = Curl_strndup(srchost, hlen);\n", "ASMcode": "\tmov rdi,r12\n\tcall 5bc56 <Curl_strndup>\n\tmov QWORD PTR [rbp+0x0],rax\n"}, {"PLcode": " if(!as->src.host)\n", "ASMcode": "\ttest rax,rax\n\tje ff1b <altsvc_createid+0x119>\n"}, {"PLcode": " goto error;\n\n as->dst.host = Curl_strndup(dsthost, dlen);\n", "ASMcode": "\tmov rsi,rbx\n\tmov rdi,r13\n\tcall 5bc56 <Curl_strndup>\n\tmov QWORD PTR [rbp+0x10],rax\n"}, {"PLcode": " if(!as->dst.host)\n", "ASMcode": "\ttest rax,rax\n\tje ff1b <altsvc_createid+0x119>\n"}, {"PLcode": " goto error;\n\n as->src.alpnid = srcalpnid;\n", "ASMcode": "\tmov DWORD PTR [rbp+0xc],r15d\n"}, {"PLcode": " as->dst.alpnid = dstalpnid;\n", "ASMcode": "\tmov DWORD PTR [rbp+0x1c],r14d\n"}, {"PLcode": " as->src.port = curlx_ultous(srcport);\n", "ASMcode": "\tmov edi,DWORD PTR [rsp+0x8]\n\tcall 6b8fa <curlx_ultous>\n\tmov WORD PTR [rbp+0x8],ax\n"}, {"PLcode": " as->dst.port = curlx_ultous(dstport);\n", "ASMcode": "\tmov edi,DWORD PTR [rsp+0xc]\n\tcall 6b8fa <curlx_ultous>\n\tmov WORD PTR [rbp+0x18],ax\n"}, {"PLcode": "\n return as;\nerror:\n altsvc_free(as);\n return NULL;\n}\n", "ASMcode": "\tmov rax,rbp\n\tadd rsp,0x18\n\tpop rbx\n\tpop rbp\n\tpop r12\n\tpop r13\n\tpop r14\n\tpop r15\n\tret \n"}, {"PLcode": " srchost++;\n", "ASMcode": "\tadd r12,0x1\n"}, {"PLcode": " hlen -= 2;\n", "ASMcode": "\tlea rsi,[rdx-0x2]\n\tjmp fea1 <altsvc_createid+0x9f>\n"}, {"PLcode": " dsthost++;\n", "ASMcode": "\tadd r13,0x1\n"}, {"PLcode": " dlen -= 2;\n", "ASMcode": "\tsub rbx,0x2\n\tjmp feae <altsvc_createid+0xac>\n"}, {"PLcode": " altsvc_free(as);\n", "ASMcode": "\tmov rdi,rbp\n\tcall fd89 <altsvc_free>\n"}, {"PLcode": " return NULL;\n", "ASMcode": "\tmov ebp,0x0\n\tjmp fef5 <altsvc_createid+0xf3>\n"}, {"PLcode": " return NULL;\n", "ASMcode": "\tmov ebp,0x0\n"}]}]
|
jsonDataSet.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:58a894d88c6b5b68723daa7d57ae88a4d8970989e9c0712a98d3bac35bf653be
|
3 |
+
size 32414671
|