s0rg / phpunisher

Finds smelly php code pieces

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Go Report Card Maintainability Test Coverage

License Go Version Release Downloads

phpunisher

Finds code pieces, that looks like viruses/trojans inside php source code.

Tested on following public malware collections:

features

  • powered by great php-parser library
  • selected scanners run in parrallel
  • no signatures
  • fully customized detection rules

installation

usage

~# cd /to/your/php/code
~# phpunisher -report                  # to see report
~# phpunisher | xargs -d "\n" -n 1 rm  # to remove suspicios

or

~# phpunisher -dump-conf > my_rules.yaml
~# $EDITOR my_rules.yaml # edit to suit your needs
~# cd /to/your/php/code
~# phpunisher -conf /path/to/my_rules.yaml -report

flags

-conf string
    load scanners config from file
-dump-conf
    dump default scanners config to stdout
-mask string
    scan masks, use ';' as separator (default "*.php*")
-report
    show report for found suspects
-score float
    minimal score to threat file as suspect
-version
    show version
-workers int
    workers count (scan parallelism) (default 2)

scanners

  • array-call finds function calls from array elements
  • array-ops notifies if array operations amount is over 20% of all operations
  • escapes notifies if string literal has more than two escaped symbols
  • evals scans for eval expression
  • funcs scans againts 'bad function' list (based on this article)
  • include notifies if whole file is single include instruction
  • long-str notifies if string literal rather long (>64 chars) and does not contains any spaces (encoded blobs)

About

Finds smelly php code pieces

License:MIT License


Languages

Language:Go 97.8%Language:Makefile 2.2%