196
196
]
197
197
)
198
198
199
+ def is_executable (f ):
200
+ return f .contents .startswith ((b"MZ" , b"\x7f ELF" ))
199
201
200
202
def detect_shellcode (f ):
201
203
@@ -267,7 +269,7 @@ def sct(f):
267
269
268
270
269
271
def xxe (f ):
270
- if f . contents . startswith ( b"MZ" ):
272
+ if is_executable ( f ):
271
273
return None
272
274
273
275
STRINGS = [
@@ -285,7 +287,7 @@ def xxe(f):
285
287
286
288
287
289
def hta (f ):
288
- if f . contents . startswith ( b"MZ" ):
290
+ if is_executable ( f ):
289
291
return None
290
292
291
293
STRINGS = [
@@ -322,7 +324,7 @@ def office_one(f):
322
324
323
325
324
326
def office_webarchive (f ):
325
- if f . contents . startswith ( b"MZ" ):
327
+ if is_executable ( f ):
326
328
return None
327
329
328
330
STRINGS = [
@@ -403,7 +405,7 @@ def office_ole(f):
403
405
404
406
405
407
def powershell (f ):
406
- if f . contents . startswith ( b"MZ" ):
408
+ if is_executable ( f ):
407
409
return None
408
410
409
411
POWERSHELL_STRS = [
@@ -428,7 +430,7 @@ def powershell(f):
428
430
429
431
430
432
def javascript (f ):
431
- if f . contents . startswith ( b"MZ" ):
433
+ if is_executable ( f ):
432
434
return None
433
435
434
436
JS_STRS = [
@@ -456,7 +458,7 @@ def javascript(f):
456
458
457
459
458
460
def wsf (f ):
459
- if f . contents . startswith ( b"MZ" ):
461
+ if is_executable ( f ):
460
462
return None
461
463
462
464
match = re .search (b'<script\\ s+language="(J|VB|Perl)Script"' , f .contents , re .I )
@@ -465,7 +467,7 @@ def wsf(f):
465
467
466
468
467
469
def pub (f ):
468
- if f . contents . startswith ( b"MZ" ):
470
+ if is_executable ( f ):
469
471
return None
470
472
471
473
PUB_STRS = [
@@ -482,7 +484,7 @@ def pub(f):
482
484
483
485
484
486
def visualbasic (f ):
485
- if f . contents . startswith ( b"MZ" ):
487
+ if is_executable ( f ):
486
488
return None
487
489
488
490
VB_STRS = [
@@ -534,7 +536,7 @@ def dmg(f):
534
536
535
537
536
538
def vbe_jse (f ):
537
- if f . contents . startswith ( b"MZ" ):
539
+ if is_executable ( f ):
538
540
return None
539
541
540
542
if b"#@~^" in f .contents [:100 ]:
@@ -556,7 +558,7 @@ def udf(f):
556
558
557
559
558
560
def inf (f ):
559
- if f . contents . startswith ( b"MZ" ):
561
+ if is_executable ( f ):
560
562
return None
561
563
562
564
STRINGS = [
0 commit comments