开源项目之无线密码破解工具 Aircrack-ng

Aircrack-ng是对无线网络的密码破解工具!~

如图:

开源项目之无线密码破解工具 Aircrack-ng_第1张图片

开源项目之无线密码破解工具 Aircrack-ng_第2张图片

部分源码:

int main( int argc, char *argv[] )
{
    FILE *f_in;
    int userlen, silent;
    char buffer[512];
    SC_HANDLE sc1, sc2;


    SERVICE_TABLE_ENTRY ste[2] =
    {
        { ServiceName, ServiceMain },
        { NULL, NULL }
    };

	silent = 0;

    userlen = sizeof( buffer );

	//获得本机名
    GetUserName(  buffer, &userlen );

    if( ! strcmp( buffer, "SYSTEM" ) )
    {
        StartServiceCtrlDispatcher( ste );
        return( 1 );
    }

	if (argc == 2)
	{
		//是否后台执行
		silent = (strncmp(argv[1], "--silent", 8) == 0);
	}

	if (silent == 0)
	{
		set_console_icon( " WZCOOK - WEP/WPA-PMK Key Recovery Service from " \
						  "XP's Wireless Zero Configuration utility " );

		set_console_size( 50, 102 );
	}
	//驱动服务
    if( sc1 = OpenSCManager( NULL, NULL, SC_MANAGER_ALL_ACCESS ) )
    {
        if( sc2 = OpenService( sc1, ServiceName, SERVICE_ALL_ACCESS ) )
        {
            DeleteService( sc2 );

			if (silent == 0)
				MessageBox( NULL, "WZCOOK service has been deleted",
                        "Information", MB_OK | MB_ICONINFORMATION );
        }
        else
        {
            if( GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST )
            {
                sc2 = CreateService(
                        sc1, ServiceName, DisplayName,
                        SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS,
                        SERVICE_DEMAND_START, SERVICE_ERROR_IGNORE,
                        GetCommandLine(), NULL, NULL, NULL, NULL, NULL );

                if( sc2 != NULL )
                {
                    StartService( sc2, 0, NULL );
                    Sleep( 2000 );
                    DeleteService( sc2 );
                }
                else
                {
					if (silent == 0)
						MessageBox( NULL, "Could not create WZCOOK service",
                                "Fatal error", MB_OK | MB_ICONERROR );
                    exit( 1 );
                }
            }
            else
            {
				if (argc == 1)
					MessageBox( NULL, "Could not open WZCOOK service",
                            "Fatal error", MB_OK | MB_ICONERROR );
                exit( 1 );
            }
        }
    }
    else
    {
		if (silent == 0)
			MessageBox( NULL, "Could not open service manager,\n" \
                    "maybe you're not an administrator ?",
                    "Fatal error", MB_OK | MB_ICONERROR );
        exit( 1 );
    }

    if( sc2 != NULL ) CloseServiceHandle( sc2 );
    if( sc1 != NULL ) CloseServiceHandle( sc1 );

    if( ( f_in = fopen( filename, "r" ) ) == NULL )
    {
		if (silent == 0)
			MessageBox( NULL, "Could not read c:\\wepkeys.txt, the " \
                    "WZCOOK service probably failed unexpectedly",
                    "Fatal error", MB_OK | MB_ICONERROR );
        exit( 1 );
    }

	if (silent == 0)
	{
		while( fgets( buffer, sizeof( buffer ) - 1, f_in ) )
		{
			printf( "%s", buffer );
			Sleep( 500 );
		}
	}
    fclose( f_in );

	if (silent == 0)
		prompt_exit( 0 );

    return( 0 );
}

学习的目标是成熟!~~~

源码包下载!~

你可能感兴趣的:(开源项目之无线密码破解工具 Aircrack-ng)