Add antileech for amule

* add antileech for amule-dlp

aMule-dlp必备组件缺少这个插件aMule-dlp是不能正常下载东西的.

* Delete Makefile

* Delete CString_wx.h

* Delete Interface.cpp

* Delete Makefile.am

* Delete antiLeech.cpp

* Delete antiLeech.h

* Delete antiLeech_wx.cpp

* Delete antiLeech_wx.h

* Delete autogen.sh

* Delete configure.ac

* Delete sdc2amule.diff

* add antileech for amule-dlp

aMule-dlp必备组件缺少这个插件aMule-dlp是不能正常下载东西的.

* Update README
This commit is contained in:
ope087 2018-11-19 17:03:34 +08:00 committed by coolsnowwolf
parent aee91483b9
commit 2b98cdae2e
12 changed files with 2119 additions and 1 deletions

3
README
View File

@ -12,7 +12,8 @@
1. 首先装好 Ubuntu 64bit推荐 Ubuntu 14 LTS x64
2. 命令行输入 sudo apt-get update ,然后输入
sudo apt-get install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils
sudo apt-get install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils
编译amule 需要安装额外的包 autoconf automake libtool autopoint
3. git clone https://github.com/coolsnowwolf/lede 命令下载好源代码,然后 cd lede 进入目录

View File

@ -0,0 +1,58 @@
#
# Copyright (C) 2007-2009 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=antileech
PKG_VERSION:=2.3.2
PKG_RELEASE:=1
#PKG_SOURCE:=antileech-2.3.1.tar.gz
#PKG_SOURCE_URL:=@SF/amule
#PKG_MD5SUM:=a892a1cc00d03e943e03434d182fe73e
PKG_BUILD_DEPENDS:=libgd
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
define Package/antileech
SUBMENU:=P2P
SECTION:=net
CATEGORY:=Network
TITLE:=AntiLeech for amule
URL:=http://www.amule.org/
DEPENDS:=+libc +amule +libwxbase
endef
TARGET_LDFLAGS += \
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
define Build/Configure
sed -i "s:^AC_CHECK_PROG.WXCONFIG,.*::g" $(PKG_BUILD_DIR)/configure.ac
sed -i "s:wx-config --cppflags:$(STAGING_DIR)/usr/bin/wx-config --cppflags:g" $(PKG_BUILD_DIR)/configure.ac
cd $(PKG_BUILD_DIR) && sh ./autogen.sh
$(call Build/Configure/Default)
endef
define Build/Compile
$(MAKE) -k -C $(PKG_BUILD_DIR) \
HOSTCC="$(HOSTCC)" \
DESTDIR="$(PKG_INSTALL_DIR)" \
all install
endef
define Package/antileech/install
$(INSTALL_DIR) $(1)/usr/share/amule
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/amule/libantiLeech.so $(1)/usr/share/amule
endef
$(eval $(call BuildPackage,antileech))

View File

@ -0,0 +1,63 @@
/**
* Author: Bill Lee<bill.lee.y@gmail.com>
* License: GNU GPL
*/
//---------------------
#ifndef CSTRING_WX_H
#define CSTRING_WX_H
//#include <wx/wx.h>
#include <wx/string.h>
class CString : public wxString{
public:
CString(){}
CString(wxChar c, size_t n=1): wxString(c, n){}
CString(const wxChar* str): wxString(str){}
CString(const wxString& str): wxString(str){}
CString(const CString& str): wxString(str){}
//---------------------
CString& operator=(const wxChar* str){
wxString::operator=(str);
return *this;
}
//operator*() from wxString;
size_t GetLength()const{ return Length(); }
wxChar GetAt(size_t nIndex)const{ return GetChar(nIndex); }
//IsEmpty() from wxString;
CString& TrimLeft(wxChar c){
size_t pos = find_first_not_of(c);
if(pos == 0)
return *this;
erase(0, pos);
return *this;
}
CString& TrimRight(wxChar c){
size_t pos = find_last_not_of(c) + 1;
if(pos == Length())
return *this;
erase(pos, Length() - pos);
return *this;
}
CString Trim(){
CString ret(*this);
ret.wxString::Trim(false); /* wxString::Trim(bool fromright = true) */
ret.wxString::Trim(true);
return ret;
}
//Find(wxChar) and Find(wxChar*) from wxString;
int Find(const CString& str)const{ return wxString::Find(str.c_str()); }
int ReverseFind(const wxChar c)const{ return wxString::Find(c, true); }
int ReverseFind(const wxChar* str)const{ return rfind(str); }
int ReverseFind(const CString& str)const{ return rfind(str); }
CString Right(size_t len)const{ return wxString::Right(len); }
CString Left(size_t len)const{ return wxString::Left(len); }
#if wxCHECK_VERSION(2, 9, 0)
CString Mid(size_t first, size_t count = wxString::npos)const{
#else
CString Mid(size_t first, size_t count = wxSTRING_MAXLEN)const{
#endif
return wxString::Mid(first, count);
}
};
#endif

View File

@ -0,0 +1,28 @@
/*
* =====================================================================================
*
* Filename: Interface.cpp
*
* Description: A part of aMule DLP
*
* Created: 2011-02-24 19:49
*
* Author: Bill Lee , bill.lee.y@gmail.com
*
* Copyright (c) 2011, Bill Lee
* License: GNU General Public License
*
* =====================================================================================
*/
/* ##### HEADER FILE INCLUDES ################################################### */
#include "antiLeech.h"
/* ##### FUNCTION DEFINITIONS - EXPORTED FUNCTIONS ############################ */
extern "C" IantiLeech* createAntiLeechInstant(){
return new CantiLeech;
}
extern "C" int destoryAntiLeechInstant(IantiLeech* ptr){
delete ptr;
return 0;
}

View File

@ -0,0 +1,16 @@
AUTOMAKE_OPTIONS = foreign
pkgdir = $(datadir)/amule
ACLOCAL_AMFLAGS = -I m4
pkg_LTLIBRARIES = libantiLeech.la
libantiLeech_la_CPPFLAGS = ${ANTILEECH_CPPFLAGS}
libantiLeech_la_LDFLAGS = ${ANTILEECH_LDFLAGS} -module -avoid-version --no-la-files
libantiLeech_la_SOURCES = \
antiLeech.h \
antiLeech_wx.h \
CString_wx.h \
antiLeech.cpp \
antiLeech_wx.cpp \
Interface.cpp

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,161 @@
#ifndef ANTILEECH_H
#define ANTILEECH_H
#pragma once
#include "antiLeech_wx.h"
#include "CString_wx.h"
class IantiLeech
{
public:
virtual ~IantiLeech(){}; /* Bill Lee: Not be used currently */
//BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD,LPVOID);
virtual DWORD GetDLPVersion() = 0;
//old versions to keep compatible
/* //drop old version support
virtual LPCTSTR DLPCheckModstring(LPCTSTR modversion, LPCTSTR clientversion);
virtual LPCTSTR DLPCheckUsername(LPCTSTR username);
virtual LPCTSTR DLPCheckNameAndHash(CString username, CString& userhash);
*/
//new versions
virtual LPCTSTR DLPCheckModstring_Hard(LPCTSTR modversion, LPCTSTR clientversion) = 0;
virtual LPCTSTR DLPCheckModstring_Soft(LPCTSTR modversion, LPCTSTR clientversion) = 0;
virtual LPCTSTR DLPCheckUsername_Hard(LPCTSTR username) = 0;
virtual LPCTSTR DLPCheckUsername_Soft(LPCTSTR username) = 0;
virtual LPCTSTR DLPCheckNameAndHashAndMod(const CString& username, const CString& userhash, const CString& modversion) = 0;
virtual LPCTSTR DLPCheckMessageSpam(LPCTSTR messagetext) = 0;
virtual LPCTSTR DLPCheckUserhash(const PBYTE userhash) = 0;
virtual LPCTSTR DLPCheckHelloTag(UINT tagnumber) = 0;
virtual LPCTSTR DLPCheckInfoTag(UINT tagnumber) = 0;
//void TestFunc();
//Bill Lee: no need in interface abstract class
//private:
// static bool IsTypicalHex (const CString& addon);
};
//Bill Lee: never call delete on IantiLeech, use destoryAntiLeechInstat instead.
extern "C" IantiLeech* createAntiLeechInstant();
extern "C" int destoryAntiLeechInstant(IantiLeech*);
class CantiLeech: public IantiLeech
{
public:
//BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD,LPVOID);
virtual DWORD GetDLPVersion(){ return DLPVersion; }
//old versions to keep compatible
/* //drop old version support
virtual LPCTSTR DLPCheckModstring(LPCTSTR modversion, LPCTSTR clientversion);
virtual LPCTSTR DLPCheckUsername(LPCTSTR username);
virtual LPCTSTR DLPCheckNameAndHash(CString username, CString& userhash);
*/
//new versions
virtual LPCTSTR DLPCheckModstring_Hard(LPCTSTR modversion, LPCTSTR clientversion);
virtual LPCTSTR DLPCheckModstring_Soft(LPCTSTR modversion, LPCTSTR clientversion);
virtual LPCTSTR DLPCheckUsername_Hard(LPCTSTR username);
virtual LPCTSTR DLPCheckUsername_Soft(LPCTSTR username);
virtual LPCTSTR DLPCheckNameAndHashAndMod(const CString& username, const CString& userhash, const CString& modversion);
virtual LPCTSTR DLPCheckMessageSpam(LPCTSTR messagetext);
virtual LPCTSTR DLPCheckUserhash(const PBYTE userhash);
virtual LPCTSTR DLPCheckHelloTag(UINT tagnumber);
virtual LPCTSTR DLPCheckInfoTag(UINT tagnumber);
//void TestFunc();
private:
static const DWORD DLPVersion;
static bool IsTypicalHex (const CString& addon);
};
//<<< new tags from eMule 0.04x
#define CT_UNKNOWNx0 0x00 // Hybrid Horde protocol
#define CT_UNKNOWNx12 0x12 // http://www.haspepapa-welt.de (DodgeBoards)
#define CT_UNKNOWNx13 0x13 // http://www.haspepapa-welt.de (DodgeBoards)
#define CT_UNKNOWNx14 0x14 // http://www.haspepapa-welt.de (DodgeBoards)
#define CT_UNKNOWNx15 0x15 // http://www.haspepapa-welt.de (DodgeBoards) & DarkMule |eVorte|X|
#define CT_UNKNOWNx16 0x16 // http://www.haspepapa-welt.de (DodgeBoards)
#define CT_UNKNOWNx17 0x17 // http://www.haspepapa-welt.de (DodgeBoards)
#define CT_UNKNOWNx4D 0x4D // pimp my mule (00de)
#define CT_UNKNOWNxE6 0xE6 // http://www.haspepapa-welt.de
#define CT_UNKNOWNx22 0x22 // DarkMule |eVorte|X|
#define CT_UNKNOWNx5D 0x5D // md4
#define CT_UNKNOWNx63 0x63 // ?
#define CT_UNKNOWNx64 0x64 // ?
#define CT_UNKNOWNx69 0x69 // eMuleReactor //Xman don't use this, it's webcache!
#define CT_UNKNOWNx6B 0x6B // md4
#define CT_UNKNOWNx6C 0x6C // md4
#define CT_UNKNOWNx74 0x74 // md4
#define CT_UNKNOWNx76 0x76 // www.donkey2002.to
#define CT_UNKNOWNx79 0x79 // Bionic
#define CT_UNKNOWNx7A 0x7A // NewDarkMule
#define CT_UNKNOWNx83 0x83 // Fusspi
#define CT_UNKNOWNx87 0x87 // md4
#define CT_UNKNOWNx88 0x88 // DarkMule v6 |eVorte|X|
#define CT_UNKNOWNx8c 0x8c // eMule v0.27c [LSD7c]
#define CT_UNKNOWNx8d 0x8d // unknown Leecher - (client version:60)
#define CT_UNKNOWNx94 0x94 // 00.de community //Xman 20.08.05
#define CT_UNKNOWNx97 0x97 // Emulereactor Community Mod
#define CT_UNKNOWNx98 0x98 // Emulereactor Community Mod
#define CT_UNKNOWNx99 0x99 // eMule v0.26d [RAMMSTEIN 8b]
#define CT_UNKNOWNx9C 0x9C // Emulereactor Community Mod
#define CT_UNKNOWNxbb 0xbb // emule.de (client version:60)
#define CT_UNKNOWNxc4 0xc4 //MD5 Community from new bionic - hello
#define CT_UNKNOWNxC8 0xc8 // MD5 Community from new bionic - hello //Xman x4
#define CT_UNKNOWNxCA 0xCA // NewDarkMule
#define CT_UNKNOWNxCD 0xCD // www.donkey2002.to
#define CT_UNKNOWNxCE 0xCE // FRZ community //Xman 20.08.05
#define CT_UNKNOWNxCF 0xCF // FRZ community //Xman 20.08.05
#define CT_UNKNOWNxDA 0xDA // Emulereactor Community Mod
#define CT_UNKNOWNxEC 0xec // SpeedMule and clones //Xman x4
#define CT_UNKNOWNxF0 0xF0 // Emulereactor Community Mod
#define CT_UNKNOWNxF4 0xF4 // Emulereactor Community Mod
#define CT_UNKNOWNxD2 0xD2 // Chinese Leecher //SquallATF
//#define CT_UNKNOWNx85 0x85 // viper-israel.org and eChanblardNext //zz_fly, viper become good
#define CT_FRIENDSHARING 0x66 //eWombat [SNAFU]
#define CT_DARK 0x54 //eWombat [SNAFU]
#define FRIENDSHARING_ID 0x5F73F1A0 // Magic Key, DO NOT CHANGE!
// unknown eMule tags
#define ET_MOD_UNKNOWNx12 0x12 // http://www.haspepapa-welt.de
#define ET_MOD_UNKNOWNx13 0x13 // http://www.haspepapa-welt.de
#define ET_MOD_UNKNOWNx14 0x14 // http://www.haspepapa-welt.de
#define ET_MOD_UNKNOWNx17 0x17 // http://www.haspepapa-welt.de
#define ET_MOD_UNKNOWNx2F 0x2F // eMule v0.30 [OMEGA v.07 Heiko]
#define ET_MOD_UNKNOWNx30 0x30 // aMule 1.2.0
#define ET_MOD_UNKNOWNx36 0x36 // eMule v0.26
#define ET_MOD_UNKNOWNx3C 0x3C // enkeyDev.6 / LamerzChoice 9.9a
#define ET_MOD_UNKNOWNx41 0x41 // CrewMod (pre-release mod based on Plus) identification
#define ET_MOD_UNKNOWNx42 0x42 // CrewMod (pre-release mod based on Plus) key verification
#define ET_MOD_UNKNOWNx43 0x43 // CrewMod (pre-release mod based on Plus) version info
#define ET_MOD_UNKNOWNx50 0x50 // Bionic 0.20 Beta]
#define ET_MOD_UNKNOWNx59 0x59 // emule 0.40 / eMule v0.30 [LSD.12e]
#define ET_MOD_UNKNOWNx5B 0x5B // eMule v0.26
#define ET_MOD_UNKNOWNx60 0x60 // eMule v0.30a Hunter.6 + eMule v0.26
#define ET_MOD_UNKNOWNx64 0x64 // LSD.9dT / Athlazan(0.29c)Alpha.3
#define ET_MOD_UNKNOWNx76 0x76 // http://www.haspepapa-welt.de (DodgeBoards)
#define ET_MOD_UNKNOWNx84 0x84 // eChanblardv3.2
#define ET_MOD_UNKNOWNx85 0x85 // ?
#define ET_MOD_UNKNOWNx86 0x86 // ?
#define ET_MOD_UNKNOWNx93 0x93 // ?
#define ET_MOD_UNKNOWNxA6 0xA6 // eMule v0.26
#define ET_MOD_UNKNOWNxB1 0xB1 // Bionic 0.20 Beta]
#define ET_MOD_UNKNOWNxB4 0xB4 // Bionic 0.20 Beta]
#define ET_MOD_UNKNOWNxC8 0xC8 // Bionic 0.20 Beta]
#define ET_MOD_UNKNOWNxC9 0xC9 // Bionic 0.20 Beta]
#define ET_MOD_UNKNOWNxDA 0xDA // Rumata (rus)(Plus v1f) - leecher mod?
//>>> eWombat [SNAFU_V3]
#undef __declspec
#endif

View File

@ -0,0 +1,25 @@
//Author: greensea <gs@bbxy.net>
#include "antiLeech_wx.h" //Modified by Bill Lee.
//Bug fixed by Orzogc Lee
LPCTSTR StrStrI(LPCTSTR haystack, LPCTSTR needle){
//Bill Lee: allocate wchar array on the stack
wchar_t haystacki[512];
wchar_t needlei[512];
int i = 0;
do{
haystacki[i] = towlower(haystack[i]);
if(i == 511)
break;
}while(haystack[i++]); //As haystacki is allocated on the stack, it wans't set 0. So the NULL needs to be copy.
i = 0;
do{
needlei[i] = towlower(needle[i]);
if(i == 511)
break;
}while(needle[i++]);
const wchar_t* ret = wcsstr(haystacki, needlei);
if(ret != NULL)
ret = ret - haystacki + haystack;
return ret;
}

View File

@ -0,0 +1,54 @@
#ifndef ANTILEECH_WX_H
#define ANTILEECH_WX_H
#include <wx/defs.h>
#include <string.h>
#include <wctype.h> // for towlower()
#define LPCTSTR const wxChar*
#define BOOL bool
//#define _T(var) wxT(var) //defined in wxWidgets
#define DWORD wxUint32
#define UINT wxUint16
#define WINAPI
#define HINSTANCE
#define LPVOID void*
#define PBYTE unsigned char*
#define TCHAR wxChar
#define _TINT wxInt32
#define SSIZE_T ptrdiff_t
#define StrCmpI _tcsicmp
#define _tcsicmp _wcsicmp
#define _istdigit(var) iswdigit(var)
#define _istcntrl(var) iswcntrl(var)
#define _istpunct(var) iswpunct(var)
#define _istspace(var) iswspace(var)
#define _istxdigit(var) iswxdigit(var)
inline float _tstof(const wchar_t* str){
wchar_t** ptail = NULL;
return wcstof(str, ptail);
}
//This function is not used. by Orzogc Lee
//But I think there is no need to removing, linker will remove it.
/*
inline void tolowers(wxChar* str){
int i = 0;
do{
str[i] = towlower(str[i]);
}while(str[++i]);
}
*/
#define _tcsstr(haystack, needle) wcsstr(haystack, needle)
#define _tcslen(var) wcslen(var)
#define StrStr(a, b) wcsstr(a, b)
#define StrStrIW(a, b) StrStrI(a, b)
LPCTSTR StrStrI(LPCTSTR haystack, LPCTSTR needle);
//Bill Lee: I think inlining this function make no senses, because it is a very large operation.
#define _wcsicmp(a, b) wcscasecmp(a, b)
#define StrCmpIW(a, b) wcscasecmp(a, b)
#endif

View File

@ -0,0 +1,8 @@
mkdir -pv m4
libtoolize
aclocal
aclocal -I m4
automake --add-missing --copy
autoconf

View File

@ -0,0 +1,44 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# Copyright (C) 2011 Bill Lee <bill.lee.y@gmail.com>
# License: GNU GPL v3 or any later version released by Free Software Foundation
#AC_PREREQ([2.65])
AC_INIT([antiLeech], [44], [https://github.com/persmule/amule-dlp/issues])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE()
AC_CONFIG_SRCDIR([antiLeech.cpp])
#AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_MAKE_SET
AM_DISABLE_STATIC
AC_PROG_LIBTOOL
#Check for wx-config
AC_CHECK_PROG(WXCONFIG, [wx-config], [wx-config])
ANTILEECH_CPPFLAGS=$(wx-config --cppflags)
AC_SUBST(ANTILEECH_CPPFLAGS)
# Checks for libraries.
ANTILEECH_LDFLAGS=
AC_SUBST(ANTILEECH_LDFLAGS)
# Checks for header files.
AC_CHECK_HEADERS([string.h], [wx/string.h], [wx/defs.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_SIZE_T
# Checks for library functions.
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View File

@ -0,0 +1,61 @@
--- antiLeech.cpp.win 2016-02-15 19:31:18.748711749 +0800
+++ antiLeech.cpp 2016-02-15 20:49:25.691484626 +0800
@@ -17,8 +17,11 @@
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#include <atlstr.h>
+#include "CString_wx.h"
#include "antiLeech.h"
+#define __declspec(var) CantiLeech::
+#define SPECIAL_DLP_VERSION
+#define ALL_VERYCD_MOD
#ifdef _DEBUG
#define new DEBUG_NEW
@@ -51,7 +54,10 @@ LPCTSTR apszSnafuTag[]=
//,_T("[eChanblardNext]") //21 zz_fly
};
+const DWORD CantiLeech::DLPVersion = 4405;
+//deactivate M$WIN-specific codes
+#if 0
BOOL WINAPI DllMain (
HANDLE hModule,
DWORD dwFunction,
@@ -74,6 +80,7 @@ void __declspec(dllexport) TestFunc()
{
::MessageBox(NULL,_T("Inside the DLL!"),_T("Nix"),0);
}
+#endif
//old versions just to keep compatible
/* //drop old version support
@@ -285,7 +292,7 @@ LPCTSTR __declspec(dllexport) DLPCheckNa
*/
//end old version ------------------------------------------
-bool IsTypicalHex(CString& addon)
+bool CantiLeech::IsTypicalHex(const CString& addon)
{
if(addon.GetLength()>25 || addon.GetLength()<5)
return false;
@@ -1244,7 +1251,7 @@ LPCTSTR __declspec(dllexport) DLPCheckUs
return NULL;
}
-LPCTSTR __declspec(dllexport) DLPCheckNameAndHashAndMod(CString username, CString& userhash, CString& modversion)
+LPCTSTR __declspec(dllexport) DLPCheckNameAndHashAndMod(const CString& username, const CString& userhash, const CString& modversion)
{
if(username.IsEmpty() || userhash.IsEmpty())
return NULL;
@@ -1309,7 +1316,7 @@ LPCTSTR __declspec(dllexport) DLPCheckNa
//Check for aedit
//remark: a unmodded emule can't send a space at last sign
- if(modversion.IsEmpty() && username.Right(1)==32)
+ if(modversion.IsEmpty() && username.Right(1)==_T(" "))
return _T("AEdit");
//Check for Hex-Modstring