centos6.7环境编译winexe1.1

winexe1.0版本执行某些windows设备命令时,无法执行成功,遂编译winexe1.1版本。

————————————————————————————————————————————————

获取winexe源码包与samba源码包

git clone git://git.code.sf.net/p/winexe/winexe-waf winexe-winexe-waf

git clone git://git.samba.org/samba.git samba

——————————————————————————————————————————

编译安装gmp

安装版本:gmp-6.1.2

./configure
make
make install

——————————————————————————————————————————

编译安装nettle2.7.1

./configure --prefix=/usr/local/winexe
make
make install
echo /usr/local/winexe/lib64 >> /etc/ld.so.conf
ldconfig

———————————————————————————————————————————

编译安装gnutls3.3.26

export NETTLE_CFLAGS="-I/usr/local/winexe/include/nettle" NETTLE_LIBS="-L/usr/local/winexe/lib64 -lnettle" HOGWEED_CFLAGS="-I/usr/local/winexe/include/nettle" HOGWEED_LIBS="-L/usr/local/winexe/lib64 -lhogweed" GMP_CFLAGS="-I/usr/local/winexe/include" GMP_LIBS="-L/usr/local/winexe/lib -lgmp"
./configure
make
make install

___________________________________________________________________________

安装需要软件

yum install git
yum install python-devel
yum install libcom_err-devel
yum install popt-devel
yum install zlib-devel
yum install zlib-static
yum install glibc-devel
yum install glibc-static
yum install libacl-devel.x86_64
yum install openldap-devel

___________________________________________________________________________

安装linux、windows交叉编译文件

mingw32-gcc-4.9.2-1.el6.x86_64.rpm
mingw32-gcc-c++-4.9.2-1.el6.x86_64.rpm
mingw64-gcc-4.9.2-1.el6.x86_64.rpm
mingw64-gcc-c++-4.9.2-1.el6.x86_64.rpm
......

安装上面的rpm包,没有全部列出,缺少哪些再去下载

——————————————————————————————————————————

编译winexe源码包与samba源码包

#per winexe bug 64, samba needs to be reverted to a6bda1f2bc85779feb9680bc74821da5ccd401c5

cd samba

git reset --hard a6bda1f2bc85779feb9680bc74821da5ccd401c5

 

cd winexe-winexe-waf/source

#modify 'wscript_build', and at the very end ...

//修改wscript_build文件,静态连接gnutls库

stlib='smb_static bsd z resolv rt',

lib='dl gnutls'

编译:

./waf --samba-dir=../../samba configure build

编译完成,结果文件:winexe-static

参考文档:

http://rand0m.org/2015/08/05/winexe-1-1-centos-6-and-windows-2012-r2/

https://centos.pkgs.org/6/epel-x86_64/mingw32-winpthreads-3.3.0-1.el6.noarch.rpm.html

 

——————————————————————————

后续调试winexe,发现有的机器可以成功,有的机器无法成功。

报错信息:

ERROR: CreateService failed. NT_STATUS_ACCESS_DENIED

 

问题原因不是特别清楚,但查阅资料了解到应该是目标机器程序阻止了winexe远程访问,

关闭防火墙依旧无效。

然后参考文档 UAC 远程限制禁用,发现就可以访问了。

More info here: http://support.microsoft.com/kb/951016

Implement the LocalAccountTokenFilterPolicy registry key, as described in the KB article, and that should resolve your issue. Or you can turn off UAC, but that's not recommended.

要禁用 UAC 远程限制,请执行以下步骤︰

  1. 单击开始,单击运行,输入regedit,,然后按 enter 键。
  2. 找到并单击以下注册表子项:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
  3. 如果将 LocalAccountTokenFilterPolicy 注册表项不存在,请按照下列步骤︰
    1. 编辑菜单中,指向
      新建,然后单击DWORD 值
    2. 类型
      LocalAccountTokenFilterPolicy,,然后按 ENTER。
  4. LocalAccountTokenFilterPolicy,用鼠标右键单击,然后单击
    修改
  5. 数值数据框中,键入
    1,然后单击确定
  6. 退出注册表编辑器。

参考文档:

https://serverfault.com/questions/72082/winexe-gives-error-error-failed-to-install-service-winexesvc-nt-status-acces

https://support.microsoft.com/zh-cn/help/951016/description-of-user-account-control-and-remote-restrictions-in-windows

 

winexe1.1版本登录windows XP不通解决:

将XP系统中简单文件夹共享去掉,启用远程IPC共享和远程管理共享。

参考:

http://opensourceinfo.blogspot.com/2010/01/winexe.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值