cuckoosandbox / cuckoo

Cuckoo Sandbox is an automated dynamic malware analysis system
http://www.cuckoosandbox.org
Other
5.55k stars 1.71k forks source link

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

Open exodus67 opened 6 years ago

exodus67 commented 6 years ago
My issue is:

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

My Cuckoo version and operating system are:" Cuckoo Ver 2.0.6; Win10 x64
Norrax commented 5 years ago

Same problem here.

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

Norrax

Coamoo commented 5 years ago

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.

PurpleSubmarine commented 5 years ago

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

motaur commented 5 years ago

Same problem, I am eager to solution

Tigzy commented 5 years ago

Same problem

Tigzy commented 5 years ago

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...

Tigzy commented 5 years ago

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:\python27\python.exe "C:\Python27\Scripts\cuckoo-script.py" "web"

Tigzy commented 5 years ago

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

coding: utf-8

Tigzy commented 5 years ago

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.

The web server should run.

Tigzy commented 5 years ago

Now working :) image

Yvonne2020219 commented 5 years ago

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:\Python27\Lib\site-packages\cuckoo". ———————————————————————————————————— 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

Tigzy commented 5 years ago

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

KirSlayk commented 5 years ago

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

srensamblador commented 5 years ago

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!

Tigzy commented 5 years ago

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

NewSystemGames commented 5 years ago

Same Issue, After doing the method mentioned by Tigzy

The cuckoo interface file dragging , etc would not work.

Tigzy commented 5 years ago

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

sovello commented 5 years ago

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.

Tigzy commented 5 years ago

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

Abderrahmenee commented 4 years ago

@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

adkharat commented 4 years ago

C:\Python27\Scripts>cuckoo web File "C:\Python27\Scripts\cuckoo", line 1 SyntaxError: Non-ASCII character '\x90' in file C:\Python27\Scripts\cuckoo 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

  2. Added main() line at bottom of min.py file and SAVE the file

  3. Run python main.py web -H 0.0.0.0 -p 8080 from CMD

  4. 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