Cuckoo: SyntaxError: Non-ASCII character '\x90' in file C:\Python27\Scripts\cuckoo on line 1, but no encoding declared

Created on 16 Oct 2018  Β·  21Comments  Β·  Source: cuckoosandbox/cuckoo

My issue is:

Upon running cuckoo web command; I've gotten the error message as follow
"SyntaxError: Non-ASCII character 'x90' in file C:Python27Scriptscuckoo on line 1, but no encoding declared"

My Cuckoo version and operating system are:" Cuckoo Ver 2.0.6; Win10 x64

Most helpful comment

Ok so I have a VERY HACKY workaround (until a fix), you will need to run cuckoo and API from installed module, and the web part from sources.

  • Download sources
  • modify main.py to add this line in the end:
    main()
  • now run main.py from command line:
    python main.py web -H 0.0.0.0 -p 8080

The web server should run.

All 21 comments

Same problem here.

Did u found a solution for this or does it still remain?

Norrax

I also have this issue. Even tried to run python -m cuckoo web which used to work when i had the same problem with flask.

I have the same environment as the OP and having the same issue. Any solution available?

Same problem, I am eager to solution

Same problem

Is there a way to run the webserver from sources? I tried to look at main.py but can't understand how the web method is invoked...

Adding some information: When looking at the calls with ProcessHacker, I see calling "cuckoo web" creates a cuckoo.exe process which in turn creates a python.exe child process with command:
c:python27python.exe "C:Python27Scriptscuckoo-script.py" "web"

I think a simple fix would be to add this line in main.py BEFORE it's converted to exe

coding: utf-8

Ok so I have a VERY HACKY workaround (until a fix), you will need to run cuckoo and API from installed module, and the web part from sources.

  • Download sources
  • modify main.py to add this line in the end:
    main()
  • now run main.py from command line:
    python main.py web -H 0.0.0.0 -p 8080

The web server should run.

Now working :)
image

Ok so I have a VERY HACKY workaround (until a fix), you will need to run cuckoo and API from installed module, and the web part from sources.

  • Download sources
  • modify main.py to add this line in the end:
    main()
  • now run main.py from command line:
    python main.py web -H 0.0.0.0 -p 8080

The web server should run.

Amazing!!!
Thank you so much!!!
When I did as you said, the problem was solved.
I modified the main.py in this folder "C:Python27Libsite-packagescuckoo".
β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
when I restart cuckoo later,cuckoo web continue to POST and snapshot not start again.
The problem is that main.py be added code "main()".
The solution I found in "http://www.sanjaysaha.info/blog/installation-of-cuckoo-sandbox-in-windows-10/" is to copy "cuckoo-script.py" and rename it cuckoo.
123

No problem :)
Yeah it works too, I just didn't want to modify existing package to avoid breaking with updates

image

@Tigzy
I do not have the ability to drag the file for analysis, do you know what the problem is? submit doesn't work either
Host: windows 10

Ok so I have a VERY HACKY workaround (until a fix), you will need to run cuckoo and API from installed module, and the web part from sources.

  • Download sources
  • modify main.py to add this line in the end:
    main()
  • now run main.py from command line:
    python main.py web -H 0.0.0.0 -p 8080

The web server should run.

This fixed it. Thanks dude!

@KirSlayk to me it sounds like cuckoo isn't working. Did you launch the 3 services ? (cuckoo, API, web)

Same Issue, After doing the method mentioned by Tigzy

The cuckoo interface file dragging , etc would not work.

@NewSystemGames this is typical of Cuckoo main script not running, can you verify ?

This error message comes with a suggestion and it reads

_SyntaxError: Non-ASCII character 'x90' in file /path/to/file on line #lineno, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details_

The bold part is where the suggestion is. This PEP is very straight forward and the solution is just to define an encoding for your source file.
You will most likely to have

#!/usr/bin/env python
# coding=utf-8

The interpreter line is optional, but the coding can be defined second if you have interpreter line or first if you dont

Set the encoding depending on your character sets. utf-8 should work for most cases, or you may need other encodings.

@sovello I tried this and it's not the issue. The fix has been given above, thanks.

@Tigzy I used you solution and it looks like the cuckoo web interface is working. but after I submit a file and start the analysis it get stuck to pending state

C:Python27Scripts>cuckoo web
File "C:Python27Scriptscuckoo", line 1
SyntaxError: Non-ASCII character 'x90' in file C:Python27Scriptscuckoo on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

I am stilling facing the above issue.

Changes I made:-

  1. Added Utf encoding at top of main.py file
    #!/usr/bin/env python
    # coding=utf-8
  1. Added main() line at bottom of min.py file and SAVE the file
  2. Run python main.py web -H 0.0.0.0 -p 8080 from CMD
  3. Rerun cuckoo and cuckoo web from CMD

t1
t2
t3
t4

Can anyone please, tell me what is exact work around.
@Tigzy
@wyzora
@sovello
@srensamblador

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Tigzy picture Tigzy  Β·  7Comments

rayenmessaoudi picture rayenmessaoudi  Β·  4Comments

myhsu picture myhsu  Β·  5Comments

Tigzy picture Tigzy  Β·  8Comments

adricnet picture adricnet  Β·  7Comments