New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows compiler error #10760

Closed
Green-m opened this Issue Oct 7, 2018 · 1 comment

Comments

Projects
None yet
1 participant
@Green-m
Contributor

Green-m commented Oct 7, 2018

Steps to reproduce

I want to use the compiler to compile a windows service exe, but it throws an error and stops.

Expected behavior

Works well like mingw32

Current behavior

[3] pry(#<Msf::Modules::Mod706f73742f77696e646f77732f6d616e6167652f6d6574737663::MetasploitModule>)> code = File.read("/tmp/metsvc.c");nil
=> nil
[4] pry(#<Msf::Modules::Mod706f73742f77696e646f77732f6d616e6167652f6d6574737663::MetasploitModule>)> bin =  Metasploit::Framework::Compiler::Windows.compile_c(code)
Metasm::ParseError: invalid specifier list near "uintptr_t" at "</usr/include/sys/_types/_uintptr_t.h>" line 30,
	included from "\"/usr/include/i386/types.h\"" line 95,
	included from "</usr/include/machine/types.h>" line 36,
	included from "\"/usr/include/mach/i386/_structs.h\"" line 38,
	included from "</usr/include/mach/machine/_structs.h>" line 34,
	included from "\"/usr/include/i386/_mcontext.h\"" line 36,
	included from "</usr/include/machine/_mcontext.h>" line 30,
	included from "</usr/include/sys/signal.h>" line 148,
	included from "</usr/include/sys/wait.h>" line 110,
	included from "</usr/include/stdlib.h>" line 66,
	included from "\"<unk>\"" line 3
from /Users/green/.rvm/gems/ruby-2.5.1@metasploit-framework/gems/metasm-1.0.3/metasm/parse_c.rb:2069:in `parse_type_base'

The source code file is on https://gist.github.com/Green-m/1e3c4a4170d99e1c741dafc3bc4e15be

It could be compiled by ming32-64

System stuff

Metasploit version

commit 1370b59e6698452adf2b0c99da85669c4a19ec07
Author: Metasploit <metasploit@rapid7.com>
Date:   Sat Aug 25 20:31:52 2018 -0700

    automatic module_metadata_base.json update

I installed Metasploit with:

OS

Darwin greens-MacBook-Pro.local 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64

$ ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]

CC: @wchen-r7

@Green-m

This comment has been minimized.

Show comment
Hide comment
@Green-m

Green-m Oct 17, 2018

Contributor

This is resolved by adding some define, related #10281

Another problem when using metasm to compile c code is that the command line parameter cannot pass into main function, like int main(int argc char **argv), always wrong value.

A approach is to GetCommandLine() to parse the parameters, the whole file of windows service source code is at #10822

Anyway, all problems have been solved, so that it should be closed.

Contributor

Green-m commented Oct 17, 2018

This is resolved by adding some define, related #10281

Another problem when using metasm to compile c code is that the command line parameter cannot pass into main function, like int main(int argc char **argv), always wrong value.

A approach is to GetCommandLine() to parse the parameters, the whole file of windows service source code is at #10822

Anyway, all problems have been solved, so that it should be closed.

@Green-m Green-m closed this Oct 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment