mò
\@ÿAc           @   s^  d  Z  d Z d Z y e Wn d \ Z Z n Xy| d k Z d k Z d k Z d k Z d k	 Z	 e i
 i e i i e	 i e i ƒ  ƒ d d d g ƒ ƒ d	 k l Z l Z Wn1 y e i i d
 e ƒ Wn e GHn X‚  n Xe i d i e i ƒ d Z e i d ƒ d Z e i ƒ  d Z d „  Z d k Td „  Z d „  Z e d j o e ƒ  n d S(   ss  fake DNS server for internet cafe lockdown

   this is for use in a situation where you only want certain people
   to have access to the gateway, but everyone can reach the local net.
   this returns the same IP for every name lookup. of course, this
   doesn't help against smart-alecks who know what IP they want to
   visit, so you have to play with the routing also.s2  
    fakebind -- return chosen IP for every name lookup
    Copyright (C) 2004  John Comeau <jc@jcomeau.com>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    s5   Not all needed libraries found, upgrade or check pathi   i    Ni   t   libt   python(   s   gpls	   jclicenses   %s
iÿÿÿÿt   .c          G   s   t  S(   N(   t   False(   t   whatever(    (    t   ./fakebind.pyt
   DebugPrint5   s    (   t   *c          C   s¬   t  d d ƒ } t t t ƒ } y | i d | f ƒ Wn8 | d } | i d | f ƒ t i i	 d | ƒ n Xt i i	 d ƒ x% t
 o | i d ƒ }  t |  ƒ qƒ Wd S(   s0  listen for DNS queries and answer...

    our answers don't have to match any reality but our own
    all dns questions and answers have 5 fields, some of which are often
    empty: header, question, answer RRs, authority RRs, additional RRs, where
    RR is Resource Record; see RFC 1035 for specifics
 t   domaint   udps   0.0.0.0i   s   Using unprivileged port %d
s   Fake DNS server listening
N(   t   getservbynamet   dns_portt   sockett   AF_INETt
   SOCK_DGRAMt   udplistenert   bindt   syst   stderrt   writet   Truet   recvt   requestR   (   R   R   R   (    (    R   t   serve;   s     
 c           C   s   d  S(   N(    (    (    (    R   t
   dns_headerP   s    t   __main__(   i   i    (   t   __doc__t	   Copyrightt   errormessageR   R   R   t   ost   typest   ret   pwdt   patht   appendt   sept   joint   getpwuidt   geteuidt   com.jcomeaut   gplt	   jclicenseR   R   t   argvt   splitt   selft   commandt   originalselfR   R   R   R   t   __name__(   R(   R   R   R   R.   R   R,   R   R   R   R   R    R)   R-   R   R   R   (    (    R   t   ?   s2   -8				