LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   [ compiling pyv8 ] error: command 'gcc' failed with exit status 1 [ fedora server 27 ] (https://www.linuxquestions.org/questions/programming-9/%5B-compiling-pyv8-%5D-error-command-gcc-failed-with-exit-status-1-%5B-fedora-server-27-%5D-4175622625/)

////// 01-29-2018 09:07 AM

[ compiling pyv8 ] error: command 'gcc' failed with exit status 1 [ fedora server 27 ]
 
hello all.

i am trying to compile pyv8 but i cant because i get an error.

Code:

In file included from /home/thug/pyv8/build/v8_r19632/src/elements.h:32:0,
                from /home/thug/pyv8/build/v8_r19632/src/objects-inl.h:38,
                from /home/thug/pyv8/build/v8_r19632/src/v8.h:62,
                from src/V8Internal.h:7,
                from src/Utils.cpp:12:
/home/thug/pyv8/build/v8_r19632/src/objects.h: At global scope:
/home/thug/pyv8/build/v8_r19632/src/objects.h:6440:44: error: left operand of shift expression ‘(-1 << 3)’ is negative [-fpermissive]
  static const int kElementsKindMask = (-1 << kElementsKindShift) &
                                        ~~~~^~~~~~~~~~~~~~~~~~~~~~
/home/thug/pyv8/build/v8_r19632/src/objects.h:8631:36: error: left operand of shift expression ‘(-8 << 26)’ is negative [-fpermissive]
      (~kMaxCachedArrayIndexLength << kArrayIndexHashLengthShift) |
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: command 'gcc' failed with exit status 1

i am following these steps :

Code:

$ git clone https://github.com/buffer/pyv8.git
$ cd pyv8
~/pyv8 $ python setup.py build # <-- here i get the error
~/pyv8 $ sudo python setup.py install

anyone with a clue what to do next?

ntubski 01-29-2018 05:20 PM

Looks like a bug in the source, possibly when that was written the compiler was less strict so it didn't trigger an error. I believe the [-fpermissive] at the end of the message indicates you can pass that flag to the compiler to turn the error into a warning. Try adding
Code:

extra_compile_args += ['-fpermissive']
to setup.py, around line 249 should probably work (though I'm not very familiar with such setup code).

https://gcc.gnu.org/onlinedocs/gcc-7...ex-fpermissive
Quote:

-fpermissive
Downgrade some diagnostics about nonconformant code from errors to warnings. Thus, using -fpermissive will allow some nonconforming code to compile.

NevemTeve 01-30-2018 02:17 AM

@OP: You could edit the problematic lines in object.h Eg.:
Code:

Old: int whatnot = -1 << 7;
New: int whatnot = ((unsigned)-1) << 7;


////// 01-30-2018 06:53 AM

thanks.
i got it to compile a little further with ntubski's code. throws a different error.

Code:

[thug@thug pyv8]$ sudo python setup.py build
WARN: V8_HOME doesn't exists or point to a wrong folder,
/usr/lib/python2.7/site-packages/setuptools/dist.py:347: UserWarning: Normalizing '1.0-dev' to '1.0.dev0'
  normalized_version,
running build
====================
INFO: Patching the GYP scripts
INFO: skip to patch the Google v8 build/standalone.gypi file
====================
INFO: building Google v8 with GYP for x64 platform with release mode
--------------------
INFO: build v8 from SVN ...
DEBUG: > make -j 8 objectprint=off i18nsupport=off verifyheap=off debuggersupport=on regexp=native vtunejit=off extrachecks=off visibility=on snapshot=on strictaliasing=on liveobjectlist=off backtrace=on gdbjit=off disassembler=off werror=no library=shared x64.release
ERROR: build v8 from SVN failed: code=2
<-- snip -->

<-- snip -->
g++ -pthread -shared -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld build/temp.linux-x86_64-2.7/src/Utils.o build/temp.linux-x86_64-2.7/src/Exception.o build/temp.linux-x86_64-2.7/src/Context.o build/temp.linux-x86_64-2.7/src/Engine.o build/temp.linux-x86_64-2.7/src/Wrapper.o build/temp.linux-x86_64-2.7/src/Debug.o build/temp.linux-x86_64-2.7/src/Locker.o build/temp.linux-x86_64-2.7/src/AST.o build/temp.linux-x86_64-2.7/src/PrettyPrinter.o build/temp.linux-x86_64-2.7/src/PyV8.o -L/usr/local/lib -L/home/thug/pyv8/build/v8_r19632/out/x64.release/obj.target/tools/gyp/ -L/usr/lib64 -lboost_python -lboost_thread -lboost_system -lrt -lv8_base.x64 -lv8_snapshot -lpython2.7 -o build/lib.linux-x86_64-2.7/_PyV8.so -fPIC -lrt
/bin/ld: cannot find -lv8_snapshot
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1

i got it to compile after ...
Code:

V8_SNAPSHOT_ENABLED = False
... i edited that code in setup.py at line number 63.
not sure if it was right thing to do.

Code:

[thug@thug thug]$ sudo thug -h

Synopsis:
    Thug: Pure Python honeyclient implementation

    Usage:
        thug [ options ] url

    Options:
        -h, --help                      Display this help information
        -V, --version                  Display Thug version
        -i, --list-ua                  Display available user agents
        -u, --useragent=                Select a user agent (use option -b for values, default: winxpie60)
        -e, --events=                  Enable comma-separated specified DOM events handling
        -w, --delay=                    Set a maximum setTimeout/setInterval delay value (in milliseconds)
        -n, --logdir=                  Set the log output directory
        -o, --output=                  Log to a specified file
        -r, --referer                  Specify a referer
        -p, --proxy=                    Specify a proxy (see below for format and supported schemes)
        -m, --attachment                Set the attachment mode
        -l, --local                    Analyze a locally saved page
        -x, --local-nofetch            Analyze a locally saved page and prevent remote content fetching
        -v, --verbose                  Enable verbose mode
        -d, --debug                    Enable debug mode
        -q, --quiet                    Disable console logging
        -a, --ast-debug                Enable AST debug mode (requires debug mode)
        -g, --http-debug                Enable HTTP debug mode
        -t, --threshold                Maximum pages to fetch
        -j, --extensive                Extensive fetch of linked pages
        -O, --connect-timeout          Set the connect timeout (in seconds, default: 10 seconds)
        -T, --timeout=                  Set the analysis timeout (in seconds, default: 600 seconds)
        -c, --broken-url                Set the broken URL mode
        -y, --vtquery                  Query VirusTotal for samples analysis
        -s, --vtsubmit                  Submit samples to VirusTotal
        -b, --vt-apikey=                VirusTotal API key to be used at runtime
        -z, --web-tracking              Enable web client tracking inspection
        -k, --no-honeyagent            Disable HoneyAgent support

        Plugins:
        -A, --adobepdf=                Specify Adobe Acrobat Reader version (default: 9.1.0)
        -P, --no-adobepdf              Disable Adobe Acrobat Reader plugin
        -S, --shockwave=                Specify Shockwave Flash version (default: 10.0.64.0)
        -R, --no-shockwave              Disable Shockwave Flash plugin
        -J, --javaplugin=              Specify JavaPlugin version (default: 1.6.0.32)
        -K, --no-javaplugin            Disable Java plugin
        -L, --silverlight              Specify SilverLight version (default: 4.0.50826.0)
        -N, --no-silverlight            Disable SilverLight plugin

        Classifiers:
        --htmlclassifier=              Specify a list of additional (comma separated) HTML classifier rule files
        --urlclassifier=                Specify a list of additional (comma separated) URL classifier rule files
        --jsclassifier=                Specify a list of additional (comma separated) JS classifier rule files
        --vbsclassifier=                Specify a list of additional (comma separated) VBS classifier rule files
        --sampleclassifier=            Specify a list of additional (comma separated) Sample classifier rule files
        --textclassifier=              Specify a list of additional (comma separated) Text classifier rule files
        --htmlfilter=                  Specify a list of additional (comma separated) HTML filter files
        --urlfilter=                    Specify a list of additional (comma separated) URL filter files
        --jsfilter=                    Specify a list of additional (comma separated) JS filter files
        --vbsfilter=                    Specify a list of additional (comma separated) VBS filter files
        --samplefilter=                Specify a list of additional (comma separated) Sample filter files
        --textfilter=                  Specify a list of additional (comma separated) Text filter files

        Logging:
        -F, --file-logging              Enable file logging mode (default: disabled)
        -Z, --json-logging              Enable JSON logging mode (default: disabled)
        -M, --maec11-logging            Enable MAEC11 logging mode (default: disabled)
        -G, --elasticsearch-logging        Enable ElasticSearch logging mode (default: disabled)
        -D, --mongodb-address=          Specify address and port of the MongoDB instance (format: host:port)
        -Y, --no-code-logging          Disable code logging
        -U, --no-cert-logging          Disable SSL/TLS certificate logging

    Proxy Format:
        scheme://[username:password@]host:port (supported schemes: http, socks4, socks5)

[thug@thug thug]$ sudo thug --list-ua
[sudo] password for thug:

Synopsis:
    Thug: Pure Python honeyclient implementation

    Available User-Agents:
        winxpie60            Internet Explorer 6.0        (Windows XP)
        winxpie61            Internet Explorer 6.1        (Windows XP)
        winxpie70            Internet Explorer 7.0        (Windows XP)
        winxpie80            Internet Explorer 8.0        (Windows XP)
        winxpchrome20        Chrome 20.0.1132.47        (Windows XP)
        winxpfirefox12        Firefox 12.0                (Windows XP)
        winxpsafari5          Safari 5.1.7                (Windows XP)
        win2kie60            Internet Explorer 6.0        (Windows 2000)
        win2kie80            Internet Explorer 8.0        (Windows 2000)
        win7ie80              Internet Explorer 8.0        (Windows 7)
        win7ie90              Internet Explorer 9.0        (Windows 7)
        win7ie100            Internet Explorer 10.0        (Windows 7)
        win7chrome20          Chrome 20.0.1132.47        (Windows 7)
        win7chrome40          Chrome 40.0.2214.91        (Windows 7)
        win7chrome45          Chrome 45.0.2454.85        (Windows 7)
        win7chrome49          Chrome 49.0.2623.87        (Windows 7)
        win7firefox3          Firefox 3.6.13                (Windows 7)
        win7safari5          Safari 5.1.7                (Windows 7)
        win10ie110            Internet Explorer 11.0        (Windows 10)
        osx10chrome19        Chrome 19.0.1084.54        (MacOS X 10.7.4)
        osx10safari5          Safari 5.1.1                (MacOS X 10.7.2)
        linuxchrome26        Chrome 26.0.1410.19        (Linux)
        linuxchrome30        Chrome 30.0.1599.15        (Linux)
        linuxchrome44        Chrome 44.0.2403.89        (Linux)
        linuxchrome54        Chrome 54.0.2840.100        (Linux)
        linuxfirefox19        Firefox 19.0                (Linux)
        linuxfirefox40        Firefox 40.0                (Linux)
        galaxy2chrome18      Chrome 18.0.1025.166        (Samsung Galaxy S II, Android 4.0.3)
        galaxy2chrome25      Chrome 25.0.1364.123        (Samsung Galaxy S II, Android 4.0.3)
        galaxy2chrome29      Chrome 29.0.1547.59        (Samsung Galaxy S II, Android 4.1.2)
        nexuschrome18        Chrome 18.0.1025.133        (Google Nexus, Android 4.0.4)
        ipadchrome33          Chrome 33.0.1750.21        (iPad, iOS 7.1)
        ipadchrome35          Chrome 35.0.1916.41        (iPad, iOS 7.1.1)
        ipadchrome37          Chrome 37.0.2062.52        (iPad, iOS 7.1.2)
        ipadchrome38          Chrome 38.0.2125.59        (iPad, iOS 8.0.2)
        ipadchrome39          Chrome 39.0.2171.45        (iPad, iOS 8.1.1)
        ipadchrome45          Chrome 45.0.2454.68        (iPad, iOS 8.4.1)
        ipadchrome46          Chrome 46.0.2490.73        (iPad, iOS 9.0.2)
        ipadchrome47          Chrome 47.0.2526.70        (iPad, iOS 9.1)
        ipadsafari7          Safari 7.0                (iPad, iOS 7.0.4)
        ipadsafari8          Safari 8.0                (iPad, iOS 8.0.2)
        ipadsafari9          Safari 9.0                (iPad, iOS 9.1)

[thug@thug thug]$

atleast i can use the honeyclient and pass options to the thug.
thank you to both of you.

next i need to configure thug.

//////

////// 01-30-2018 07:43 AM

Code:

[thug@thug ~]$ sudo thug -u linuxchrome54 -w 20000 -o /home/thug/logs/thug.log -v -t 10 -F 118.24.0.[xx]/qxxxx.exe
[sudo] password for thug:
[2018-01-30 15:38:26] [window open redirection] about:blank -> http://118.24.0.[xx]/qxxxx.exe
[2018-01-30 15:38:28] [HTTP] URL: http://118.24.0.[xx]/qxxxx.exe (Status: 200, Referer: None)
[2018-01-30 15:38:28] [HTTP] URL: http://118.24.0.[xx]/qxxxx.exe (Content-type: application/octet-stream, MD5: 43800e15dcb111a2cf8b9da694e50fea)
[2018-01-30 15:38:28] Thug analysis logs saved at ../logs/f5e7b639e18747270db89121533b0cc6/20180130153826
[thug@thug ~]$

got it configured. i obfuscated the malware serving url.
now to automate virustotal submission etc.


All times are GMT -5. The time now is 03:52 PM.