Power by DMForum.NET!
RSS | ATOM | WAP
DMForum.NET 官方支持讨论区 > 技术区 > WEB开发技术

浏览主题:??配ximh????????????????配x??配ximh???配xim??配xim.,媥i配xim??配ximh??????????配xim???i????g???配xim??????配xim?i??????

主题:??配ximh????????????????配x??配ximh???配xim??配xim.,媥i配xim??配ximh??????????配xim???i????g???配xim??????配xim?i??????
Admin
普通会员
1级
荣誉:昂居
等级:新手上路
发帖:27
金钱:0
经验:725
性别:帅哥
状态:离线
注册:2006-7-30 9:21:00
获取Leadbbs验证码的弱智程序(.Net版)  
[ 2006-8-14 10:49:00 ]
程序代码 (c#)

using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Net;
using System.Net.Sockets;

namespace LeadBBSEnder
{
    
/// <summary>
    
/// ValidateCode 的摘要说明。
    
/// </summary>

    public sealed class RunningRes
    
{
        
private static TcpClienter _tc;
        
public static TcpClienter Tcp
        
{
            
get
            
{
                
if( _tc == null )
                    _tc 
= new TcpClienter( string.Empty , new IPEndPoint(IPAddress.Any , 1710) , new IPEndPoint(IPAddress.Parse( "221.12.79.162" ) , 80) );
                
return _tc;
            }

        }


        

        
public static string GetValidateCode( Bitmap bm )
        
{
            
short s1 = Paste( bm , Position.Char1 );
            
short s2 = Paste( bm , Position.Char2 );
            
short s3 = Paste( bm , Position.Char3 );
            
short s4 = Paste( bm , Position.Char4 );
            
return string.Format("{0}{1}{2}{3}" , s1 , s2 , s3 , s4 );
        }


        
private static Point GetOffsetPoint( Position p )
        
{
            
switch( p )
            
{
                
case Position.Char1:
                    
return new Point( 2 , 1 );
                
case Position.Char2:
                    
return new Point( 9 , 1 );
                
case Position.Char3:
                    
return new Point( 16 , 1 );
                
default:
                    
return new Point( 23 , 1 );
            }

        }


        
private static short Paste( Bitmap bm , Position pc )
        
{
            
short[,] Char0 = {
                    
0,1,1,1,1,0 },
                    
1,1,0,0,1,1 },
                    
1,1,0,0,1,1 },
                    
1,1,0,0,1,1 },
                    
1,1,0,0,1,1 },
                    
1,1,0,0,1,1 },
                    
1,1,0,0,1,1 },
                    
0,1,1,1,1,0 }
                             }
;
            
short[,] Char1 = {
                    
0,0,1,1,0,0 },
                    
0,1,1,1,0,0 },
                    
0,0,1,1,0,0 },
                    
0,0,1,1,0,0 },
                    
0,0,1,1,0,0 },
                    
0,0,1,1,0,0 },
                    
0,0,1,1,0,0 },
                    
0,1,1,1,1,0 }
                             }
;
            
short[,] Char2 = {
                    
0,1,1,1,1,0 },
                    
1,1,0,0,1,1 },
                    
1,1,0,0,1,1 },
                    
0,0,0,1,1,0 },
                    
0,0,1,1,0,0 },
                    
0,1,1,0,0,0 },
                    
1,1,0,0,0,0 },
                    
1,1,1,1,1,1 }
                             }
;
            
short[,] Char3 = {
                    
0,1,1,1,1,0 },
                    
1,1,0,0,1,1 },
                    
0,0,0,0,1,1 },
                    
0,0,1,1,1,0 },
                    
0,0,0,0,1,1 },
                    
0,0,0,0,1,1 },
                    
1,1,0,0,1,1 },
                    
0,1,1,1,1,0 }
                             }
;
            
short[,] Char4 = {
                    
0,0,0,1,1,0 },
                    
0,0,1,1,1,0 },
                    
0,1,1,1,1,0 },
                    
0,1,1,1,1,0 },
                    
1,1,0,1,1,0 },
                    
0,1,1,1,1,1 },
                    
0,0,0,1,1,0 },
                    
0,0,0,1,1,1 }
                             }
;
            
short[,] Char5 = {
                    
1,1,1,1,1,1 },
                    
1,1,0,0,0,0 },
                    
1,1,0,0,0,0 },
                    
1,1,1,1,1,0 },
                    
0,0,0,0,1,1 },
                    
0,0,0,0,1,1 },
                    
1,1,0,0,1,1 },
                    
0,1,1,1,1,0 }
                             }
;
            
short[,] Char6 = {
                    
0,1,1,1,1,0 },
                    
1,1,0,1,1,0 },
                    
1,1,0,0,0,0 },
                    
1,1,1,1,1,0 },
                    
1,1,0,0,1,1 },
                    
1,1,0,0,1,1 },
                    
1,1,0,0,1,1 },
                    
0,1,1,1,1,0 }
                             }
;