Archive for 十二月, 2012

大话人工智能(1)——从信息积累到程序的自我学习

星期日, 十二月 16th, 2012 110 views

首先说一下目前的人工智能,目前人工智能的依赖体(一些NB实验室里的除外)普遍为数据堆积,即通过对大量的信息存储的检索比对来做出人类世界的客观判断。这一点有点类似于搜索引擎,通过对输入信息的比对给出相应的内容。但搜索引擎只对第一关键词进行了一个比对,并没有对语言逻辑进行一个详尽的处理。比如你在百度或谷歌输入“人类的大脑容易是多少TB”,给出的链接大多都是百度知道里相同的提问信息,如下图:


(更多…)

C++调用DLL的方法

星期六, 十二月 15th, 2012 39 views

关于C++调用DLL的方法有几种,这里给出个人认为较简单的一种,做一个简单的代码范例,见代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//引入wtypes头文件
#include <wtypes.h>

//定义一个函数指针
typedef void (  * TULIPFUNC )(void);

//定义一个函数指针变量
TULIPFUNC FUNC;

int _tmain(int argc, _TCHAR* argv[])
{
    //加载TEST.Dll
    HINSTANCE hinst=::LoadLibrary("TEST.dll");  

    //找到Dll的TESTFUNC函数
    FUNC=(TULIPFUNC )GetProcAddress(hinst,"TESTFUNC");

    //调用TESTFUNC函数
    FUNC();
}

欢迎补充及交流

BeiTown
2012.12.15

C++获取硬盘信息(序列号)源码

星期五, 十二月 14th, 2012 511 views

代码是老外的,项目中需要用到所以临时找了很多版本,这是目前测试可用性最高的版本,所有代码都写进了一个CPP里
代码有点长,限于篇幅只传一部分吧,其他后面给压缩包。此处为获取硬盘信息的入口函数,感兴趣的朋友可以试着剥离出来

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
long getHardDriveComputerID ()
{
    int done = FALSE;
    // char string [1024];
    __int64 id = 0;
    OSVERSIONINFO version;

    strcpy (HardDriveSerialNumber, "");

    memset (&version, 0, sizeof (version));
    version.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
    GetVersionEx (&version);
    if (version.dwPlatformId == VER_PLATFORM_WIN32_NT)
    {
        //  this works under WinNT4 or Win2K if you have admin rights
#ifdef PRINTING_TO_CONSOLE_ALLOWED
        printf ("\nTrying to read the drive IDs using physical access with admin rights\n");
#endif
        done = ReadPhysicalDriveInNTWithAdminRights ();

        //  this should work in WinNT or Win2K if previous did not work
        //  this is kind of a backdoor via the SCSI mini port driver into
        //     the IDE drives
#ifdef PRINTING_TO_CONSOLE_ALLOWED
        printf ("\nTrying to read the drive IDs using the SCSI back door\n");
#endif
        // if ( ! done)
        done = ReadIdeDriveAsScsiDriveInNT ();

        //  this works under WinNT4 or Win2K or WinXP if you have any rights
#ifdef PRINTING_TO_CONSOLE_ALLOWED
        printf ("\nTrying to read the drive IDs using physical access with zero rights\n");
#endif
        //if ( ! done)
        done = ReadPhysicalDriveInNTWithZeroRights ();

        //  this works under WinNT4 or Win2K or WinXP or Windows Server 2003 or Vista if you have any rights
#ifdef PRINTING_TO_CONSOLE_ALLOWED
        printf ("\nTrying to read the drive IDs using Smart\n");
#endif
        //if ( ! done)
        done = ReadPhysicalDriveInNTUsingSmart ();
    }
    else
    {
        //  this works under Win9X and calls a VXD
        int attempt = 0;

        //  try this up to 10 times to get a hard drive serial number
        for (attempt = 0;
            attempt < 10 && ! done && 0 == HardDriveSerialNumber [0];
            attempt++)
            done = ReadDrivePortsInWin9X ();
    }

    if (HardDriveSerialNumber [0] > 0)
    {
        char *p = HardDriveSerialNumber;

        WriteConstantString ("HardDriveSerialNumber", HardDriveSerialNumber);

        //  ignore first 5 characters from western digital hard drives if
        //  the first four characters are WD-W
        if ( ! strncmp (HardDriveSerialNumber, "WD-W", 4))
            p += 5;
        for ( ; p && *p; p++)
        {
            if ('-' == *p)
                continue;
            id *= 10;
            switch (*p)
            {
            case '0': id += 0; break;
            case '1': id += 1; break;
            case '2': id += 2; break;
            case '3': id += 3; break;
            case '4': id += 4; break;
            case '5': id += 5; break;
            case '6': id += 6; break;
            case '7': id += 7; break;
            case '8': id += 8; break;
            case '9': id += 9; break;
            case 'a': case 'A': id += 10; break;
            case 'b': case 'B': id += 11; break;
            case 'c': case 'C': id += 12; break;
            case 'd': case 'D': id += 13; break;
            case 'e': case 'E': id += 14; break;
            case 'f': case 'F': id += 15; break;
            case 'g': case 'G': id += 16; break;
            case 'h': case 'H': id += 17; break;
            case 'i': case 'I': id += 18; break;
            case 'j': case 'J': id += 19; break;
            case 'k': case 'K': id += 20; break;
            case 'l': case 'L': id += 21; break;
            case 'm': case 'M': id += 22; break;
            case 'n': case 'N': id += 23; break;
            case 'o': case 'O': id += 24; break;
            case 'p': case 'P': id += 25; break;
            case 'q': case 'Q': id += 26; break;
            case 'r': case 'R': id += 27; break;
            case 's': case 'S': id += 28; break;
            case 't': case 'T': id += 29; break;
            case 'u': case 'U': id += 30; break;
            case 'v': case 'V': id += 31; break;
            case 'w': case 'W': id += 32; break;
            case 'x': case 'X': id += 33; break;
            case 'y': case 'Y': id += 34; break;
            case 'z': case 'Z': id += 35; break;
            }                            
        }
    }

    id %= 100000000;
    if (strstr (HardDriveModelNumber, "IBM-"))
        id += 300000000;
    else if (strstr (HardDriveModelNumber, "MAXTOR") ||
        strstr (HardDriveModelNumber, "Maxtor"))
        id += 400000000;
    else if (strstr (HardDriveModelNumber, "WDC "))
        id += 500000000;
    else
        id += 600000000;

#ifdef PRINTING_TO_CONSOLE_ALLOWED

    printf ("\nHard Drive Serial Number__________: %s\n",
        HardDriveSerialNumber);
    printf ("\nHard Drive Model Number___________: %s\n",
        HardDriveModelNumber);
    printf ("\nComputer ID_______________________: %I64d\n", id);

#endif

    return (long) id;
}

具体就不分析了,有问题欢迎留言谈论,以下是效果截图

源码下载:
【Diskid32源码及演示下载】

在C#调用DLL包(U3D同理)

星期四, 十二月 13th, 2012 70 views

本文简单说明一下如何在Unity3D中调用一个DLL包,用法和C#调用一个DLL包一样,由于比较简单这里就直接上代码吧

1
2
3
4
5
[DllImport("DLLNAME")]//DLLNAME为dll包的名字,不需要加.dll后缀
static extern void TestFun1();//定义一个DLL包中的方法TestFun1
[DllImport("DLLNAME")]
static extern void TestFun2();//定义一个DLL包中的方法TestFun2
...

之后在代码中直接调用TestFun1() 和正常的C#函数一样使用即可
关于DLL包的放置位置,如果是C#中,和.exe执行文件同一个目录下即可
在Unity中应将DLL文件放置在 Assets\Plugins 文件夹下,没有就自己创建一个
就说到这里吧,本文意在分享,欢迎指着交流

BeiTown
2012.12.13

C++在VS中导出DLL动态链接库文件的常规方法

星期三, 十二月 12th, 2012 77 views

①建立项目:
[新建项目]选择Win32控制台应用程序,输入项目名点击确定。
在Win32应用程序向导的应用程序类型中选择DLL,附加选项勾选空项目,如下图,之后点击完成。

②创建头文件,代码如下:

1
2
3
4
5
6
7
8
#ifndef DLLTEST_H
#define DLLTEST_H //防止重复定义
 
#define DECLDIR extern "C" __declspec(dllexport) //宏定义

DECLDIR int Test(int a, int b);  //函数声明

#endif

(更多…)

C#获取硬盘序列号

星期二, 十二月 11th, 2012 103 views

本来准备直接用在U3D里的,但是无奈游戏程序一加载到该模块就完全崩溃,目前原因不明,有可能是该部分功能已经超越Unity的权限范围,不过独立的C#版本是可用的,这里先把代码发上来

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System.Management;//导入此命名空间
/**
* 该函数返回存有硬盘序列号的字符串
**/

private string GetDiskSerial()
        {
            try
            {
                ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");
                String strHardDiskID = "nothing found!";
                foreach (ManagementObject mo in searcher.Get())
                {
                    strHardDiskID = mo["SerialNumber"].ToString().Trim();
                    break;
                }
                return strHardDiskID;
            }
            catch
            {
                return "nothing found!";
            }
        }

基本原理就是调用API去与硬件底层交互
不过测试之后发现有些时候并不能获取到硬盘序列号
所以又有了第二种方法,代码如下
(更多…)

VPS虚拟主机SSH代理翻墙教程

星期六, 十二月 8th, 2012 686 views

之前Eric同学给了个国外的VPS,问我能不能利用起来做翻墙代理,这里顺便录个小教程吧

首先用SSH客户端接上VPS,这里直接用的是Tunnelier,之前用的是PuTTY但是Tunnelier功能比较强大,后面还会用到索性从头到尾使用Tunnelier好了。下载安装好Tunnelier后打开,输入VPS的帐号密码,这里是默认22端口


(更多…)

骇客级服务器初级安全防范(3) – 消除入侵者隐藏帐号

星期五, 十二月 7th, 2012 146 views

找到以前的一个webShell连上去看看,用quesr命令查看了一下,shit!发现已经被人提权了

没关系,一会连他一块端了
输入systeminfo>x.txt&(for %i in (KB952004 KB956572 KB2393802 KB2503665 KB2592799 KB2621440 KB2160329 KB970483 KB2124261 KB977165 KB958644) do @type x.txt|@find /i “%i”||@echo %i Not Installed!)&del /f /q /a x.txt
查看了一下未打的补丁,iis6漏洞位列其中,甩上去一个iis6的exploit,添加一个帐号试试
(更多…)

利用Tomcat弱口令后台渗透笔记(2)——JSP源码分析

星期四, 十二月 6th, 2012 180 views

上回说到成功上传了一个JSP木马,本节我们继续对此站进一步渗透分析
首先在木马后台中查看一下服务器的信息

可以看出是windows 2008的系统,另外根据IP来看是内网,执行命令行 netstat -an 回显
(更多…)

利用Tomcat弱口令后台渗透笔记(1)——WAR上传

星期三, 十二月 5th, 2012 283 views

通常JSP网站安全性都非常高,但也不是没有突破口,比如遇到Tomcat服务器的站,通常我们可以试着访问其8080端口,如果管理员疏忽的话有时可以出现如下界面


(更多…)