360终于要把木马做到硬件级了

2012年5月4日 1 条评论

刚才惊悉360要出手机了。

不知道是不是自带云艳照功能。

又或是周教主的欲望远不止此。

命令行修改IP

2012年5月1日 1 条评论

如题。回来以后系统出了BUG,GUI里面怎么改IP都不行,保存不了。

这时候可以用命令行来改。

netsh interface ipv4 set address “本地连接” static IP地址 子网掩码 网关IP

出来混,迟早是要还的

2012年4月17日 没有评论

所以我要说我鄙视网易

2012年4月15日 没有评论

最近网易指责腾讯新闻客户端抄袭网易客户端,至于是腾讯抄袭了CNN,还是腾讯抄了网易,还是腾讯跟网易都抄了CNN,又或是其他什么的,这个我就不说了。

之所以写这篇日志,一方面是因为之前网易的一篇公关文:http://www.cnbeta.com/articles/182443.htm,这篇公关文中充斥着大量“无耻”、“不道德”的字眼。作为一篇公关文,我觉得这样是不合适的。

第二是网易最新出来的这篇(截至发日志)公关文:http://www.cnbeta.com/articles/182614.htm,里面那个配图很有炒冷饭的意思。如果在数年前那个大家各做各的,只有腾讯做大而全的年代,将之称为腾讯的山寨文化,也未尝不可,那么在现在还这么说的话,未免就是别有居心了。

举个简单的例子,既然腾讯微博抄袭了Twitter,那么网易新闻是不是也抄袭了CNN?

另外,这篇新的公关文末尾还有这么一段话比较值得留意:

而此次网易应用中心不仅列出腾讯“抄袭”的应用专题,而且还在微博上发起“人人都是腾讯产品经理”的话题,并引发大量网友的讨论。不过目前,腾讯尚未对此做出进一步的回应。

这段话很有越俎代庖的意思——网易本不是腾讯的上级,为什么可以替腾讯找产品经理?另外,这还有煽动舆论的意思。综合这一点和之前充斥着“无耻”、“不道德”的那篇公关文,我甚至会怀疑网易背后有360指使——如今腾讯口碑日渐好转,而360日渐恶化,于是360找来网易半路杀出,再把腾讯拉下水——我承认我的这个思维已经有了360的风范(参考360被AppStore全线下架时360的公关文)。

相信网易也知道,有时间打口水仗没时间做产品的,最后都会输的——为什么迅雷不指责QQ旋风?

综上,如题。

忘掉我跟你恩怨,樱花开了几转

2012年4月12日 1 条评论

。。

从屏蔽360浏览器说起

2012年4月11日 1 条评论

今天又更新了一下以前的识别UA屏蔽360系浏览器,增加了几种屏蔽方式,感觉好像回到了好多年前各种找trick的日子,还记得那时候每当发现一个trick时候的激动,那个日子多么美好~

扯远了,事情是这样的,本来写一段C语言风格的JS或者C语言风格的PHP(= =。。)对我来说……如果只是简单的if什么的,其实我还是能写的……

于是我就被网上的同学们华丽丽的鄙视了。(嗯,我经常被鄙视……习惯了。。)

这儿说一下我之前的代码的问题。

  • 之前的正则表达式的写法是……好吧,我忘了,好像是“/360([A-Za-z.])*/i”,为什么这么写……因为这是我从其他地方复制的。这个写法有个什么问题呢,就是括号里面是输出的,然后没有用到,这当然是很浪费的啦。
  • 然后呢,一开始写的JS没有用“(function () {…}) ();”这样的代码,直接用的其中的“…”部分,这样有一个全局变量污染的问题。这个……真的不怪我啊亲……我不知道有这语法……不然我肯定会把它包起来的啊亲。

还有些什么……忘记了。

另外一开始那文章里面的转跳地址直接写的是http://newbiecoder.0ginr.com/360blocked/,我的空间提供商表示如果用的人多,我迟早流量超限,所以……我就给改了。

5小时后去搞什么体能测试

2012年4月11日 没有评论

熬夜真不是件什么好事。

所以说还是UTF8王道

2012年4月9日 没有评论

事情是这样的,今天学校ACM队某人搞了一个签到系统,然后说如果名为AB的同学第一个签到,整个签到表(文本文档)就都挂了。

当时的第一反应是那个联通问题(请Google“联通问题 utf8”),但是也没看到现场,然后琢磨着也可能是提交上去的form的编码有问题。(因为网页的编码用的是gb2312,以为可能浏览器提交了utf8的上去。)

但是后来搞签到系统那同学发了个截图,内容是“{日期} {机器号} {方框}”,但是本来的格式应该是“{姓名} {机器号} {日期}”的,也就是说整个一行都反过来了。所以就想到了UTF8里面的RLM,然后找了个可以改编码的文本编辑器,然后让它用GB2312去解释这个文本文档,然后就没问题了。

所以其实还是联通问题。

当然,如果一开始就全部使用utf8,那也就没这么多问题了。所以说嘛,还是UTF8王道。

延长Windows 7提示应用没有响应的等待时间

2012年4月7日 没有评论

修改如下(如果没有就新建)REG_SZ值:

HKEY_CURRENT_USER\Control Panel\Desktop\HungAppTimeout

内容是一个整数,表示提示之前的等待时间(毫秒),默认(不存在这个项的时候)是5000。

另外,对于编程人员,可以使用API“DisableProcessWindowsGhosting”来禁止这个提示。

最后,使用“应用程序兼容工具箱”也可以针对单个程序来禁止这个提示,不过操作较为复杂:http://blogs.technet.com/b/askperf/archive/2010/09/10/de-ghosting-your-windows.aspx

QQ对战平台本地好友编辑器

2012年4月6日 4 条评论

QQ对战平台的本地好友信息储存在%QQBattleZone%\%UIN%\Friend.dat,格式比较简单,一开始是一个DWORD,看起来总是为0,后面是一堆FriendObject(参考代码中的定义)。

在平台上好象没有查找好友的功能,只能添加同一个房子的,所以就写了这么个代码来自由添加。

代码好像写的比较烂,比如说添加好友就该单独写一个函数,偷个懒,各位勉强看吧。

/*
    Description
        
        A simple tool to manage local friends in QQ game platform.
        
    Author
    
        NewbieCoder@0GiNr
    
    Revision
        
        None
        
*/

#include <cstdio>
#include <cstring>

#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <fstream>
#include <algorithm>

struct FriendObject {
    int uin;
    char nickName[20];
    
    //
    // Except for a DWORD at the beginning, which may be face icon?
    // All the remaining bytes seem to always be zero.
    //
    
    char unknown[36];
    
    explicit FriendObject() {
        memset(this, 0, sizeof(*this));
    }
};

std::vector<FriendObject> friends;

//
// Binary read.
//

template<class type> std::istream& binaryRead(std::istream &istreamObject, type &object) {
    return istreamObject.read((char *)&object, sizeof(object));
}

//
// Binary write.
//

template<class type> std::ostream& binaryWrite(std::ostream &ostreamObject, type object) {
    return ostreamObject.write((char *)&object, sizeof(object));
}

//
// Load friends information from 'Friend.dat'
//
// File structure:
//        DWORD unknow -- Always zero.
//        One or more FriendObject follows.
//

void loadFriends(std::istream &istreamObject) {
    FriendObject friendObject;
    int temp;
    
    friends.clear();
    
    //
    // Always zero?
    //
    
    binaryRead(istreamObject, temp);
    
    //
    // Function binaryRead simplifies the work much.
    //
    
    while (binaryRead(istreamObject, friendObject)) {
        friends.push_back(friendObject);
    }
}

//
// List the friends information.
//

void dumpFriends() {
    for (FriendObject friendObject : friends) {
        std::cout << std::setw(10) << std::left << friendObject.uin << " " <<
            std::setw(25) << std::left << friendObject.nickName << std::endl;
    }
}

//
// Write friends information back.
//

void saveFriends(std::ostream &ostreamObject) {
    
    //
    // Always be zero.
    //
    
    binaryWrite(ostreamObject, (int)0);
    
    //
    // Write them back one by one.
    //
    
    for (FriendObject friendObject : friends) {
        binaryWrite(ostreamObject, friendObject);
    }
}

int main(int argc, char **argv) {
    std::string command;
    std::string fileName = "Friend.dat";
    std::ifstream inputFileStream;
    std::ofstream outputFileStream;
    bool informationModified = false;
    
    //
    // TODO: Validate arguments.
    //
    
    command = argv[1];
    
    inputFileStream.open(fileName, std::ios::binary);
    if (!inputFileStream) {
        std::cerr << "Unable to open Friend.dat." << std::endl;
        
        return -1;
    }
    
    loadFriends(inputFileStream);
    inputFileStream.close();
    
    if (command == "-list") {
        dumpFriends();
    } else if (command == "-add") {
        FriendObject friendObject;
        std::vector<FriendObject>::iterator friendPointer;
        
        //
        // Data should be write back.
        //
        
        informationModified = true;

        sscanf(argv[2], "%d", &friendObject.uin);
        strncpy(friendObject.nickName, argv[3], sizeof(friendObject.nickName));;
        
        //
        // Check if we have to add a new entry.
        //
        
        friendPointer = std::find_if(friends.begin(), friends.end(), 
            [friendObject] (FriendObject const &current) -> bool {
            return current.uin == friendObject.uin;
        });
        
        if (friendPointer == friends.end()) {
            friends.push_back(friendObject);
        } else {
            *friendPointer = friendObject;
        }
    } else if (command == "-delete") {
        int uin;
        
        sscanf(argv[2], "%d", &uin);
        
        informationModified = true;
        
        //
        // Find the corresponding entry and remove it if one exists.
        //
        
        friends.erase(std::remove_if(friends.begin(), friends.end(), 
            [uin] (FriendObject const &current) -> bool {
            return current.uin == uin;
        }), friends.end());
    } else if (command == "-clear") {
        informationModified = true;
        friends.clear();
    }
    
    //
    // Operation '-add' and '-delete' requires writting data back.
    //
    
    if (informationModified) {    
        outputFileStream.open(fileName, std::ios::binary | std::ios::trunc);
        if (!outputFileStream) {
            std::cerr << "Unable to write back to Friend.dat." << std::endl;
            
            return -1;
        }
        
        saveFriends(outputFileStream);
        
        outputFileStream.close();
    }
}