16 Commits
Author SHA1 Message Date
Jurriaan Bremer c20b3ea581 make get_parent_pid 64-bit compatible #2147 #2237
By defining the get_parent_pid() method to use a 64-bit compatible
structure definition, it's now able to get the parent process identifier
under 64-bit environments. This resolves the issue of self.ppid being
None and therefore crashing the zer0m0n.hidepid() method.

Thanks to shafaqat1, johnc2k, tosto92, and jhopz for reporting this.
2018-05-26 06:56:12 +02:00
Jurriaan Bremer 1c06d72c63 patch py27 subprocess to be unicode-aware
This commit introduces Unicode support to Python 2.7's process handling,
especially to the spawning of new processes which is handled by the
_subprocess module and uses CreateProcessA internally. Note that this
has already been resolved on Python 3's branch.

During our Windows unit tests on AppVeyor the lib/api/process.py is
imported during all unit tests, due to which all invocations of
_subprocess.CreateProcess go through our code. Therefore we handle some
edge cases that we'll never be needing in the Cuckoo Analyzer but are
nonetheless useful as reference implementation and/or for completeness.

Furthermore it should be noted that this changes the "trigger" attribute
in the configuration for Cuckoo Monitor from ASCII to UTF-8 which
requires [1] on the Cuckoo Monitor side to be used correctly. Due to
UTF-8 being ASCII compatible, this should be backwards compatible.

Finally it removes monitor/latest from hashes.txt and introduces a
cmd.exe-based Unicode command-line unit test as Python 2.7's python.exe
doesn't support Unicode command-line arguments either (apparently).

[1]: https://github.com/cuckoosandbox/monitor/commit/e071e63a66e831163a40abc45109fdf71fee829e
2018-04-23 11:35:22 +02:00
Jurriaan Bremer 78a1e7da01 modify unit test for permission denied at system process 2017-12-03 15:51:58 +01:00
Jurriaan Bremer 773c6fc854 get rid of capcom usage for disabling dse
In the past we've attempted to use Capcom to disable Driver Signature
Enforcement. With a more permanent solution upcoming, it is safe to
remove this functionality.
2017-11-09 08:45:26 +01:00
Jurriaan Bremer 984e5258cc adjustments and unit tests for upcoming monitor release
This commit modifies some parts of the Cuckoo Analyzer logic to ensure a
more smooth usage in situations where there would in the past be errors.

* Uses the error message from is32bit.exe in the CuckooError exception.
  Now that is32bit.exe will no longer throw "access denied" message
  boxes, but instead print a simple message, this will help propagate
  and handle the exact errors.
* Make the dump TLS master secrets module aware of this change and have
  it properly handle access denied issues. That is, rather than throwing
  a hard crash, it will now provide a simple warning to the end user. In
  the future this should be shown prominently in the Web Interface.
* A couple of unit tests are introduced to test the above as well as
  various stability improvements in the is32bit.exe utility when it
  looks at potential MZ-DOS/PE files.

Conflicts:
	cuckoo/data-private/cwd/hashes.txt
	tests/utils.py
	tests/windows/test_process.py
2017-08-29 12:11:53 +02:00
Jurriaan Bremer c3b58ab632 switch default recentfiles directory to my documents
In the past year people have been confused by the random files appearing
on the Desktop. With this change we modify this default path from the
Desktop to the "Documents" or "My Documents" directory (or a localized
version of that directory). This way it's less obvious (i.e., not to be
seen in the screenshots) and hopefully make less people confused.
2017-08-09 10:15:29 +02:00
Jurriaan Bremer 0cd42b7cb7 fix a number of unicode-related issues #1295 (thanks consen)
The PR identified the issue, but resolved it incorrectly. Instead,
properly log unicode strings in the Cuckoo Guest already. We should
still feature something to avoid hard crashes on the Host, though.
2017-06-24 04:40:25 +02:00
Jurriaan Bremer f296af8feb various smaller tweaks and unit test fix 2017-06-03 15:14:01 +02:00
Jurriaan Bremer 5c7088ca82 fix unicode filename logging issue #1606 (thanks zhaoyaochen)
Also tweaks signatures/extractor/__init__.py in Cuckoo vs Community.
2017-06-03 11:39:42 +02:00
Jurriaan Bremer 5ce43b07ac use different pipes on winxp and win7 to fix winxp support
This could be a temporary patch as surely there is a better approach,
but this has been tested as working. We have yet to write CWD migration
code, though. Fixes problems reported in #1486 #1484 #1430 #1419.
2017-04-28 18:00:53 +02:00
Jurriaan Bremer 7851f67f48 resolve issue with patching lib
Provided that the Python installation directory has a directory called
Lib, mock apparently doesn't properly import our "lib" directory. We
therefore have to slightly modify our unittests accordingly.
2017-03-17 19:20:16 +01:00
Jurriaan Bremer e85f0f5476 Merge branch 'kernel' into package
Conflicts:
	cuckoo/compat/config.py
	cuckoo/core/guest.py
	cuckoo/data/analyzer/windows/analyzer.py
	cuckoo/data/analyzer/windows/lib/api/process.py
	cuckoo/misc.py
	cuckoo/processing/debug.py
	tests/test_config.py
	tests/test_misc.py
	tests/test_startup.py
2017-03-17 15:32:35 +01:00
Jurriaan Bremer 7644860237 fix unicode filename issues and improve guest crashes
* Make hard errors out of incorrect requests to the new Cuckoo Agent as
  otherwise things fail silently which makes it harder to debug.
* Pass along a dummy filename when storing the sample, rather than its
  real name. The actual filepath where it will be stored is passed along
  in a separate variable anyway. This prevents unicode parsing issues on
  the new Cuckoo Agent side.
* Bump the default Agent to 0.7 as it contains unicode parsing tweaks.
* Remove superfluous exception handling which only made debugging worse.
  By catching the errors and then throwing only the error message we're
  missing out on the most crucial part of the errors, their stacktraces.
  Can't unittest it currently, but it has been tested to provide much
  better feedback to the Host in the case an exception occurs.
* Fix unicode vs ascii issue when the file to-be-analyzed is missing,
  which happened due to the other unicode issues mentioned above, in
  some (non-realistic) situations resulting in a completely unrelated
  (but fatal) error message.
2017-03-06 04:57:46 +01:00
Jurriaan Bremer 48c7b6f35b start on unit tests for integrating kernel work 2017-01-26 00:02:00 +01:00
Jurriaan Bremer 69b715ab99 check most of the analyzer code by importing the analyzer itself
At the very least this will catch basic syntax errors and/or
initialization issues.
2017-01-17 23:33:53 +01:00
Jurriaan Bremer 7d6f73b191 report missing pil/pillow package not as a warning
We'll be working on reducing the amount of warnings, errors, and
exceptions thrown around in the Cuckoo Analyzer in order to confuse our
users less and let our unittests work properly (which trigger a failure
upon such events). Introduces unit tests for the Cuckoo Analyzer.
2017-01-17 23:21:18 +01:00