How can a client lie about its IP address to the server (HTTP)

I'm trying to set the user agent property to other than Java/1.4.2_02, and also send requests to the server that should appear coming from ip specified by me. In another words i am trying that I could hit the server with variety of different setting of user-agent and ip address. I have this piece of code that works fine for the user-agent. But how can I send request to the server mimicking different ip addresses. Any ideas?thanks
I don't to download the page. I just have to send the requests.
Here is the code that sends different user-agent configurations to the server:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.text.html.HTMLDocument;
public class teste {
private static HttpURLConnection conn = null;
private static URL url = null;
private static HTMLDocument html = new HTMLDocument();
public static void main(String args[]) {
BufferedReader in = null;
String str = "";
try {
url = new URL("http://www.google.com/search?hl=de&ie=ISO-8859-1&q=test");
} catch(MalformedURLException e) {
System.out.println(e);
System.exit(-1);
try {
conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.2) Gecko/20040803");
conn.connect();
in = new BufferedReader(new InputStreamReader(url.openStream()));
} catch(IOException e) {
System.out.println(e);
System.exit(-1);
}

There is bad news, and their is worse news.
You need raw sockets. Java doesn't do raw sockets.
Windows doesn't eithier (XP SP2), though there ARE ways arround it, the problem is you will need to be administrator and it will be throttled (read SLOW) by the OS itself (no way arround this) and it will refuse to send Spoofed IPs (no sensible way arround this).
Linux you need to be root.
You need to write a JNI that will drop your requests onto the network.
It's horrible, and you need to consider whether java is the right language for this. Sounds like you are just doing some NATting or proxying or such, which would be much easier to do in pure c. Unfortunately I have to have raw packets from java so pain and suffering for me.

Similar Messages

  • How can I view information about an image, such as the file name and exposure,  on the Ipad?

    how can I view information about an image, such as the file name and exposure,  on the Ipad?

    You can't with the built-in Photos app, but there are apps such as iPhoto which allow you to see the exposure details (aperture, shutter speed, focal length, ISO). PhotoMeta also shows you that info

  • How can I create a new E-mail address for the Marketing Manager

    Hullo,
    how can I create a new E-mail address for the Marketing Manager (i.e. marketing professional role in SAP CRM) please.
    That when you go and create a new E-mail campaign you need to choose an E-mail form in addition to the E-mail address of the Marketing Manager.
    Kind Regards.

    Hi Alhussien
    Add it to his Position in the Organisational Model. Transaction PPOMA_CRM.
    Under there address section is an option to populate the email address.
    Regards
    Arden

  • How to tell client disconection reason when invoke disconnect() on the server side.

    Is there any way to tell client the reason for disconect when I call disconect() on the server side. its some way like using error object as optional parameter to include reject reason when invode rejectConnection

    Ignore the JSRs for now.
    Follow the JavaEE tutorial.
    http://docs.oracle.com/javaee/6/tutorial/doc/
    The answers to many of your questions will be clear to you once you have completed the tutorial.
    I also like the tutorials here (they are a little dated, but still mostly relevant as the core JEE6 specs that the tutorial relies on were released over 5 years ago and JEE7 is yet to be released).
    https://schuchert.wikispaces.com/EJB+3+and+Java+Persistence+API
    zonski has a spring+javafx focused tutorial if you would prefer to learn and use Spring than JEE (they are differing technologies which cover pretty much the same functional set):
    http://www.zenjava.com/series/building-jee-applications-in-javafx-2-0/
    JavaFX is a client side framework so there is not much you would do with it on the server side.
    It seems like there is a ton of "JSR's" for different tasks, and I'm not sure exactly what I need, and all that, so I'm really confusedNobody needs all of JEE, just use the bits that you want that are a good fit for whatever project you are doing - don't try to use everything at once.
    A lot of the stuff can be learnt and used in isolation.
    Selected relevant topics, might be (in the order that I would consider them):
    Persistence: http://docs.oracle.com/javaee/6/tutorial/doc/bnbpy.html
    Java Servlet Technology: http://docs.oracle.com/javaee/6/tutorial/doc/bnafd.html
    JAX-RS web services: http://docs.oracle.com/javaee/6/tutorial/doc/giepu.html
    Contexts and Dependency Injection: http://docs.oracle.com/javaee/6/tutorial/doc/gjbnr.html
    Enterprise Beans: http://docs.oracle.com/javaee/6/tutorial/doc/bnblr.html

  • How can I stop iCal from trying to connect to the server during corrections?

    Recently, my iCal lost the connection to my gmail calendar (and my wife's), and as I was trying to fix it (by replacing the @ in the server address with a &40-something), it turned out that iCal started trying to connect again - but this time it had lost the proper password.
    Now, it says something like "Server connection error: make sure you have the right password" - and then I'm supposed to click OK. When I do that, iCal immediately starts trying to reconnect, and I simply didn't have time to change my password or anything. Back to square one.
    I figured I should reboot, but the iMac won't let me shut down before I've shut down iCal, which again can't be done before the "Server connection.."-dialog is closed. Back to square one.
    My system is OS X 10.6.7, on a 2011 iMac.

    Quit iCal from the dock.   To do this, click and hold on the iCal icon (in the dock), and select Quit from the pop-up menu and release the click to Quit the app.
    If that fails, then click on the icon in the dock again (and while still holding the click on the icon ) press the Option key, and select Force Quit from the pop-up and release to Force Quit the app.
    I'd go after the iCal server setting via the iCal > Preferences > Accounts panel, if that's not what you're trying here.
    And if that fails, then reboot (probably unnecessary, but...), disconnect from the WiFi, launch iCal, and clean up the configuration error that way.  iCal should get a different error on a network disconnect, and should then let you access the preferences.
    The AppleScript category?  Eh?

  • How Can i Use two Different Public IP Addresses no my DMZ with ASA Firewall.

    How To Using Two Different Public IP Address on My DMZ with ASA 5520
    Postado por jorge decimo decimo em 28/Jan/2013 5:51:28
    Hi everyone out there.
    can any one please help me regarding this situation that im looking for a solution
    My old range of public ip address are finished, i mean (the 41.x.x.0 range)
    So now i still need to have in my DMZ another two servers that will bring some new services.
    Remember that those two server, will need to be accessable both from inside and from outside users (Internet users) as well.
    So as i said, my old range of public ip address is finished and we asked the ISP to gives some additional public
    ip address to address the need of the two new servers on DMZ. and the ISP gave us the range of 197.216.1.24/29
    So my quation is, on reall time world (on the equipment) how can i Use two different public ip address on the same DMZ
    on Cisco ASA 5520 v8??
    How my configuration should look like?
    I was told about implementing static nat with Sub Interfaces on both Router and ASA interface
    Can someone please do give me a help with a practical config sample please. i can as well be reached at [email protected]
    attached is my network diagram for a better understanding
    I thank every body in advance
    Jorge

    Hi,
    So looking at your picture you have the original public IP address range configured on the OUTSIDE and its used for NAT for different servers behind the ASA firewall.
    Now you have gotten a new public IP address range from the ISP and want to get it into use.
    How do you want to use this IP address range? You want to configure the public IP addresses directly on the servers or NAT them at the ASA and have private IP addresses on the actual servers (like it seems to be for the current server)?
    To get the routing working naturally the only thing needed between your Router and Firewall would be to have a static route for the new public network range pointing towards your ASA OUTSIDE IP address. The routing between your Router and the ISP core could either be handled with Static Routing or Dynamic Routing.
    So you dont really need to change the interface configuration between the Router and ASA at all. You just need a Static route pointing the new public IP address towards the ASA outside IP address.
    Now when the routing is handled between the ISP - ISP/Your Router - Your Firewall, you can then consider how to use those IP addresses.
    Do you want to use the public IP addresses DIRECTLY on the HOSTS behind the firewall?This would require you to either configure a new physical interface with the new public IP address range OR create a new subinterface with the new public IP addresses range AND then configure the LAN devices correspondingly to the chosen method on the firewall
    Do you want to use the public IP addresses DIRECLTY on the ASA OUTSIDE as NAT IP addresses?This would require for you to only start configuring Static NAT for the new servers between the inside/dmz and outside interface of the ASA. The format would be no different from the previous NAT configuration other than for the different IP addresses ofcourse
    Of the above ways
    The first way is good because the actual hosts will have the public IP addresses. Therefore you wont run into problems with DNS when the LAN users are trying to access the server.
    The second way is the one requiring the least amount of configurations/changes on the ASA. In this case though you might run into problem with DNS (to which I refer above) as the server actually has a private IP address but the public DNS might reply to the LAN hosts with a public IP address and therefore connections from LAN could fail. This is because LAN users cant connect to the servers OUTSIDE NAT IP address (unless you NAT the server to public IP address towards LAN also)
    Hopefully the above was helpfull. Naturally ask more specific questions and I'll answer them. Hopefully I didnt miss something. But please ask more
    I'm currently at Cisco Live! 2013 London so in the "worst case" I might be able to answer on the weekend at earliest.
    - Jouni

  • How can I force a DHCP client to renew its IP address??

    Hi to all,
    I have installed in a customer, a Cisco 2801 who has configured a DHCP pool. This router takes a reload every month (by maintenance purposes), when it is up (in the network we have AVAYA phones working fine, it's a call center), this phones takes a reload to renew the ip, which is assigned by the DHCP pool.
    The problem is when some phones try to renew its IP address (after the router reload), the phone detects a IP conflict an it forces a reload. This reload normally is in production hours, the agents lose their phones and they can't work......
    There is some option to force the DHCP client to do a IP renewal from the DHCP server???
    Thanks to all.
    Regards.
    David.

    First of all you should investigate what is going so horribly wrong in your network that you have to reload your router every month (and even worse in production hour). If it's an instability, have you tried to update to a newer IOS-version?
    Regarding your DHCP-problem. For that you just have to configure your DHCP-server correctly by specifying a database-agent:
    http://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ipaddr_dhcp/configuration/12-4t/dhcp-12-4t-book/config-dhcp-server.html#GUID-5F022CF5-671E-49E7-8FBD-69997EEBC730 
    With this function the router stores all bindings and knows (also after a reload) which addresses are already assigned to which system.

  • How can i get info. about sun systems in real life situation

    Hi
    infact i m not so experienced ? but i have got certification and nowadays i m improving myself and applying for jobs. please tell me how can i get info about the sun systems in real life situation. i mean that how can i get details like that mostly companies use which systems ? what is the trend of companies and how i can get detail of history of sun systems?
    Thanks in advance

    hmm.......... its very difficult to explain. an its more difficult simulate....well my suggession is to get in to some job with your present knowledge and try to learn more from there....

  • How can I get informations about PATH variable ?

    I have a programme installed on my computer and I need informations about its path. For example I can get Java home path like this:
    System.getProperty("java.home");, but how can I do that for my programme.
    If you know another way I can do this please let me find out.
    Thanks !

    To sergey35:
    Thanks! This work very well.
    Now I want to launch an application from java, but I don't know how can I test if my application exists (is installed).
    For example if I want to launch winamp or any other application, but how can I verify if my application exists indeed. The end user isn't interested if my application really exists. He push a button and he wants to launch that application. If it doesn't exists I have to notify through a message this fact. And most difficult I think is to know exactly the path where is installed that application.
    If anyone can help me with documentation or suggestions please reply to this thread.
    Thanks!

  • How can i remove my credit card from app store, the none option its not there and i don't Owen  nothing to apple, my last in app purchase was in clash of clans, please help!!! Because of that problem i cant update my apps! Plz help!!!!!

    How can i remove my credit card from app store, the none option its not there and i don't Owen  nothing to apple, my last in app purchase was in clash of clans, please help!!! Because of that problem i cant update my apps! Plz help!!!!!

    You've logged into your account and viewed your purchase history and there aren't any error messages shown (e.g. 'problem with a previous purchase'), and you haven't got any purchases due (e.g. pre-orders and/or subscriptions) : Why can’t I select None when I edit my Apple ID payment information ?

  • My phone is on disable and ask me to connect to itunes and when i try it says i need to unlock my phone? how can i unlock it if its locked ?

    my phone is on disable and ask me to connect to itunes and when i try it says i need to unlock my phone? how can i unlock it if its locked ? please help?

    Connect in recovery mode according to http://support.apple.com/kb/HT1212

  • RMI How can a Client reconnect to a server after connection(any)-error

    I have the following problem:
    My RMI-Server runs for ever. In a batch-queue I have a procedure which looks periodly wether rmiregistry
    and RMI-Server exists. On error both processes are killed and restarted.
    My client as a simple example is displaying the server time. If any communication-problem with the
    server exists, I need an automatic reconnect to the server. I accept that into the time distanz of the
    error the display is frozen. Its unacceptable to restart the client !!.
    The following example demonstates my test-example:
    Server:
    1. Start
    2. waits for connecting (factory)
    3. answer time-requests
    Client:
    1. Start
    2. create a time class initially 1.jan.1970 00:00:00
    3. Start a timer displaying the time class every second
    4. start a timer connecting/reconnecting to the server and ask the servers actual time every second
    PS. Is the server to stubil programmed, so that a hang can exists?
    It would be nice, if anybody could answer me !!
    The following sources work correctly without solving the problem of the reconnect:
    ////////////// Echo.java
    package emi.server;
    import java.rmi.*;
    import java.util.*;
    public interface Echo
    extends Remote
    public Date getTime() throws RemoteException;
    ////////////// EchoClient.java
    package emi.server;
    //import emi.utility.basics.*;
    public class EchoClient
    public static void main(String args[]) throws Exception
    EchoClient echoclient1 = new EchoClient();
    //Check the argument count
    if (args.length != 1)
    System.err.println("Usage: EchoClient <server> --> EXIT");
    System.exit(0);
    // all of time relevant things
    Etim acttim = new Etim();
    // displaying continous the time
    EchoClientDisplay disp = new EchoClientDisplay(acttim);
    disp.StartTimer();
    // transfering continous the time from the server
    EchoClientTransfer trans = new EchoClientTransfer(acttim, args[0]);
    trans.StartTimer();
    ////////////// EchoClientDisplay.java
    package emi.server;
    import java.awt.event.*;
    import javax.swing.*;
    // displaying every 750 Milliseconds the value of the time
    public class EchoClientDisplay implements ActionListener
    private Timer tim;
    private Etim tact;
    public EchoClientDisplay(Etim tact)
    tim = new Timer(750, this);
    this.tact = tact;
    public void StartTimer()
    tim.setRepeats(true);
    tim.setInitialDelay(5);
    tim.start();
    public void actionPerformed(ActionEvent e )
    System.out.println(tact.toString());
    ////////////// EchoClientTransfer.java
    package emi.server;
    import java.rmi.Naming;
    import java.rmi.RMISecurityManager;
    import java.awt.event.*;
    import javax.swing.Timer;
    import java.util.Date;
    // transferring the actual time from the server
    public class EchoClientTransfer implements ActionListener
    private Etim tact;
    private String hostname;
    private Timer tim;
    private boolean init = false;
    private Echo echoRef1 = null;
    public EchoClientTransfer(Etim tact, String hostname)
    this.tact = tact;
    this.hostname = hostname;
    this.tim = new Timer(500, this);
    public void StartTimer()
    tim.setRepeats(true);
    tim.setInitialDelay(5);
    tim.start();
    public void actionPerformed(ActionEvent e )
    //>>>>>>>>>>> this construction doesnt work correctly, its only good until the first
    // network error
    try
    if( init == false )
    // Create and install the security manager
    System.setSecurityManager(new RMISecurityManager());
    //get the remote factory object from the registry
    String url = new String("rmi://"+ hostname +"/EchoFactory");
    EchoFactory remoteFactory = (EchoFactory)Naming.lookup(url);
    //get references to new EchoImpl instances
    echoRef1 = remoteFactory.getEcho("User Meyer");
    init = true;
    if( init = true )
    //make the remote calls
    Date d = echoRef1.getTime();
    tact.setDate(d);
    catch(Exception ee)
    System.out.println(ee.toString());
    init = false;
    //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    ////////////// EchoFactory.java
    package emi.server;
    import java.rmi.RemoteException;
    import java.rmi.Remote;
    public interface EchoFactory extends Remote
    Echo getEcho(String userName) throws RemoteException;
    ////////////// EchoFactoryImpl.java
    package emi.server;
    import java.rmi.RemoteException;
    import java.rmi.server.UnicastRemoteObject;
    public class EchoFactoryImpl extends UnicastRemoteObject implements EchoFactory
    EchoFactoryImpl() throws RemoteException {};
    public Echo getEcho(String userName) throws RemoteException
    EchoImpl echoRef = new EchoImpl(userName);
    return (Echo)echoRef;
    ////////////// EchoImpl.java
    package emi.server;
    import java.rmi.RemoteException;
    import java.rmi.server.UnicastRemoteObject;
    import java.util.*;
    public class EchoImpl extends UnicastRemoteObject implements Echo
    private String userName;
    public EchoImpl() throws RemoteException
    public EchoImpl(String userName) throws RemoteException
    this.userName = userName;
    public Date getTime()
    Etim e = new Etim();
    e.setTimeAct();
    return e.get();
    ////////////// EchoServer.java
    package emi.server;
    import java.rmi.Naming;
    import java.rmi.RMISecurityManager;
    public class EchoServer
    public static void main(String args[]) throws Exception
    // Create and install the security manager
    System.setSecurityManager(new RMISecurityManager());
    // Create the servant instance for registration
    EchoFactory factoryRef = new EchoFactoryImpl();
    // Bind the object to the rmiregistry
    Naming.rebind("EchoFactory", factoryRef);
    System.out.println("Echo object ready and bound to the name 'EchoFactory'!");
    ////////////// Etim.java
    package emi.server;
    import java.util.*;
    import java.text.*;
    // this is my central class working up all time problems .. many hundred lines of code
    // I think, you must not look at this code ist setting and reading time
    // this is only a subset of methods for this example
    public class Etim
    private Date dat;
    private Calendar cal;
    public Etim()
    cal = Calendar.getInstance(); // Gregorianischer Kalender
    dat = new Date(0L); // January 1, 1970, 00:00:00
    cal.clear();
    * Zeit lesen.
    public Date get()
    return dat;
    // setting the time
    public void setDate( Date d )
    dat.setTime( d.getTime() );
    cal.setTime(dat);
    // gets my time-class to the current system-clock
    public void setTimeAct()
    long millis;
    millis = System.currentTimeMillis();
    setMilli(millis);
    * Zeit setzen.
    public void setMilli(long millis)
    dat.setTime(millis);
    cal.setTime(dat);
    // time in german format: day.month.year hour:minute:second:millisecond
    public String toString()
    return toStringTagMoJahr() + " " + toStringStdMiSek() +
    ":" + cal.get(Calendar.MILLISECOND);
    * Ausgabeformat Tag.Monat.Jahr (z.B. 01.01.2001).
    public String toStringTagMoJahr()
    SimpleDateFormat s = new SimpleDateFormat("dd.MM.yyyy");
    return s.format(dat);
    * Ausgabeformat Stunde:Minute:Sekunde (00:00:00 - 23:59:59).
    public String toStringStdMiSek()
    SimpleDateFormat s = new SimpleDateFormat("HH:mm:ss");
    return s.format(dat);

    Hello willy51,
    Thank you for answering.
    I think, your comment of the design is true - its a problem when starting up in a new enviroment and
    you have nobody who shows you the right direction at the beginning. Talking personally together only
    10 minutes is better than writing a noval.
    I thing the following model of a client works better:
    concept:
    - visualize a personal time class continously evgery second
    - if there is a connection to a server set the time-class with the server time
    - if you loss connection, try to reconnect
    question:
    in which situation hangs connectToServer() ?
    (whithout the simple errors : no rmiregistry, no rmi-server)
    public class EchoClient
    private String hostname;
    public static void main(String args[]) throws Exception
    // my internal TIME-Class
    Etim acttim = new Etim();
    // Create and install the security manager
    System.setSecurityManager(new RMISecurityManager());
    // remote call
    Echo echoRef1 = null;
    String url = new String("rmi://"+ servername:port +"/EchoFactory");
    // displaying continous the time, technic = swing.timer
    EchoClientDisplay disp = new EchoClientDisplay(acttim);
    disp.StartTimer();
    // transfering continous the time from the server, technic = swing.timer
    // The state of transfer from server = offline
    EchoClientTransfer trans = new EchoClientTransfer(acttim);
    trans.StartTimer();
    // Connect to server
    connectToServer(url, echoRef1, trans);
    // wait for ever, if connection failed, try every 5 seconds a reconnect to server
    while(true)
    // test, if connection failed. The connections fails if the Object EchoClientTransfer
    // get a error, when it asks the server for the time ( remote call )
    if(trans.getStatus() == false ) // test, if connection failed
    connectToServer(url, echoRef1, trans);
    // try it again after 5 seconds
    Thread.sleep(5000);
    private static void connectToServer(String url, Echo echoRef1, EchoClientTransfer trans)
    System.out.println("Retry connection");
    // Connect to server
    while( true )
    try
    //get the remote factory object from the registry
    EchoFactory remoteFactory = (EchoFactory)Naming.lookup(url);
    //get references to new EchoImpl instances
    echoRef1 = remoteFactory.getEcho("User Meyer");
    // reactivate Datatransfer because I have now a new connection to the server
    trans.reactivateAfterConnectionError(echoRef1);
    // end of initialisation
    break;
    catch( Exception e )
    //>>>>>>> Error initialising connection to server. try again after 5 seconds"
    Thread.sleep(5000); // retry after 5 seconds

  • HT203176 When I delete a file, it does not appear in the Trash - How can I fix this. Its a brand new MacBook Pro 17'

    When I delete a file, it does not appear in the Trash - How can I fix this. Its a brand new MacBook Pro 17''

    http://www.thexlab.com/faqs/trash.html for starters.

  • How can I control instrument using its RS232 port in VB or VC++?

    1)How can I control instrument using its RS232 port in VB or VC++?
    2)What's the module or .h file need I add-in to VB or VC++?
    3)Can you provide me some easy examples for that?
    Thanks!

    Kevin,
    I've used Measurement Studio - Tools for Visual Basic and Tools for Visual C++ (ActiveX component) for instrument control.
    I've used both the VISA and non VISA versions and they are pretty straight forward to use for GPIB, Serial or VXI.
    You might find the following page useful.
    http://www.ni.com/mstudio/cworks.htm#ICC
    Regards,
    Kamran

  • HT5957 how can i fix my iphone its already ios 7 then now need activation required

    how can i fix my iphone its already ios 7 then now need activation required

    Were you, by chance, running a beta version of iOS 7 on your phone?
    If so, this will be the problem. You will need to log Into the private developers forum athttps://developer.apple.com/support/ios/
    If you are not a developer, you will need to seek help by way of your favourite search site.

Maybe you are looking for