neutralfox -4 Junior Poster

Hello everyone,
Hope everyone fine over here. Well, i am having a small problem , actually, i am developing a software to record all visited url's (from any browser). To do that, i am using SharpPCap, I have managed to capture all packets, but the problems is with the IP, i am having all kind of IP addresses and I want to turn these IP's addresses to their respective domain names.

E.g
Google IP is 64.233.189.147 and I want the program to return www.google.com.

I have tried something but i am only getting some weird output, like
"hkg01s01-in-f104.1e100.net" instead of "www.google.com" . Dudes, I am totally confused, can someone help me please.

The code:
This is where i am using sharppcap

.
                                    .
                                    .
            DateTime time = packet.PcapHeader.Date;
            int len = packet.PcapHeader.PacketLength;
            TCPPacket tcp = (TCPPacket)packet;
            string srcIP = tcp.SourceAddress; 
            string destIP = tcp.DestinationAddress; 
                                    .
                                    .
                                    .

Here, i am trying to resolve the domain name.

.
                                    .
                                    .
try
            {
                IPHostEntry IpToDomainName = Dns.GetHostEntry(destIP);
                Console.WriteLine("DomainName: {0}", IpToDomainName.HostName);
            }
            catch
            {
                Console.WriteLine("err");
            }
                                    .
                                    .
                                    .

Thanks in advance friends.
Regards,
Mike.

neutralfox -4 Junior Poster

Thanks thanks a lot for the tip. Thats what i am doing. But can someone tell me more about the software?? Will SQL Server Express be sufficient ??

Thanks a lot in advance
Regards,
Mike

neutralfox -4 Junior Poster

Hello everybody,
Hope everyone is fine over here. Well .. actually, i am developing a networking application, or a client-server application where many clients on a LAN will connect to the server.

Actually I am a bit confused with the database part, one of the features of my application is where clients will have to fetch data from a database. What must I do ?? I am lost ..

I have made research but don't know how to tackle this problem. Actually, clients are on different computers on the network ... I don't know how to make them to connect to the database.

I am using VS 2008 which comes with SQL Server 2005 Express. Do I need additional softwares to implement this functionality?


Thanks a lot in advance guys. Hope to get an answer soon.

Regards,
Mike

neutralfox -4 Junior Poster

Yeah .. you are right. That's what i am going to do. Thanks a lot again dude.

neutralfox -4 Junior Poster

lol ... that's what i am going to do. Btw, thanks again for your advice man. ;). Hmm ... do you think this project is OK, i mean ... do you think that the level is good for a final year project?

neutralfox -4 Junior Poster

Thanks a lot guys. Your advices were really helpful. Finally... a lecturer proposed something interesting. A software that will monitor bandwidth, ISP speed throttle, remote control of application, filtering website URL's, generating reports and much more. What do you think guys, Is it nice for a final year project?

neutralfox -4 Junior Poster

Hello everyone,
Hope you are fine. Actually, I am going to implement a network program for my final year project and i am a bit confuse on the methodology to use. I have already reviewed extreme programming, v-model and agile but still can't find the right one. I have approximately 10 months to develop the whole system. Can someone help me please. Any advice is welcome. :idea:

Thanks a lot in advance guys.
Regards,
Mike.

neutralfox -4 Junior Poster

lol ... but i will give my boss the option to choose between mail or to view it online. He just have to choose a particular date and time... then view all the transactions which have taken place.

He will only check the system from time to time and no mail bombing. Anyway , thanks for the reply but can you suggest me a topic please. I love security things ... I am out of idea! Thanks again dude.

neutralfox -4 Junior Poster

To be frank ... i dont really know. I want something that deals with network security! Of course, the keylogger will be used in a good way. It will not be liked the other keyloggers .. well i am planning to record information in a database and the data can be accessed via the web in a well formatted web page.

Parents can used this software to monitor what their children are doing or boss can use this to monitor an employee.

Please help me. Again, thanks a lot.

neutralfox -4 Junior Poster

Hello,
Hope everyone fine over here. Well ... actually i am having some difficulties to choose my final year. I want to develop a desktop application. As i am in the network security field, i want to develop a keylogger software. I am new to vb.net and i dont know c# at all. I am ready to learn any new language if required.

So, can someone tell me the level of difficulty of this project please and which language will be best to develop a keylogger. Or can someone give me an idea for any other software in the field. Thanks a lot in advance guys.

Regards,
Mike

neutralfox -4 Junior Poster

Hello Hello everybody,
Well ... actually i am planning to work on a search engine to index some specific pages and music files on the web. Its the first i am going to do this and i have no idea. Can you suggest to me the best programming language to use and the level of difficulty and complexity of the project. And also where should i start. I already done a search on Google but im a bit confused. Thanks a lots in advance guys.

Regards,
Mike ;)

neutralfox -4 Junior Poster

Hello friends,
I am currently working on a website, http://www.waskle.com/news.php , the goal is to manage RSS feeds from different sources(news source). It will be like, all top news under the same roof. Well, i have already coded the rss engine, everything works fine. But the problem is with the tag generation... i want to generate the tag from each feeds automatically. Can someone help me please , thanks a lot in advance.

Regards,
Mike

neutralfox -4 Junior Poster

Thanks for the answer Teme64, I will try it and let you know.

neutralfox -4 Junior Poster

Hello guys,
Actually I am working on a software in .NET. The software objectives is to search for all music files in a specifies directory or the whole computer and display the files names in a list box.

But the problem is with the directory. How can I used .Net to scan the whole computer or a "specific directory."

So far, I have been able to scan only special directories:

Public Class frmSpecusAnalyser

    Private Sub btnAnalyse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnalyse.Click
        Me.lstMusicFiles.Items.Clear()

        Dim numOfFiles As Integer = 0
        Dim foundSong As String
        Dim progValue As Integer = 0
        prgBrAnalyser.Value = 0


        For Each foundSong In My.Computer.FileSystem.GetFiles(My.Computer.FileSystem.SpecialDirectories.MyDocuments, _
            FileIO.SearchOption.SearchAllSubDirectories, "*.mp3*", "*.mp4*")


            Me.lstMusicFiles.Items.Add(foundSong)
            numOfFiles += 1

            If progValue <= 100 Then
                prgBrAnalyser.Value = progValue
                progValue += 1
            End If

        Next

        lblNumOfFiles.Text = numOfFiles.ToString

        If Me.lstMusicFiles.Items.Count < 1 Then
            MsgBox("Oops, no music files found!")
        End If



    End Sub



End Class

Thanks a lot in advance guys.

Regards,
Mike

neutralfox -4 Junior Poster

Thanks tuse.

@ Salem, in the link you send me:

Mention that:

"CCP Registered ports SHOULD NOT be used without IANA registration.
The registration procedure is defined in [RFC4340], Section 19.9."

So I can't use port 0 - 49151.
What happened if i used one of these ports ? Will I have to pay a fine? And how much is the registration ?

Because its just a open source software which I am developing for learning and to share among friends.

Thanks a lot for your answers.

neutralfox -4 Junior Poster

Thanks for the answer guys! To Salem, you suggest me to allow the user to configure or set the port himself? OK, but will it make my program less user friendly ?

I understand you but how MSN works ?

To tuse, I got your point ... I must create a form to allow the user to choose another port if there is a BindException. Thanks...

But still I want to know MSN Messenger works !!! I made some research but can't find anything useful that can help me to make my program more efficient.

Thanks a lot for your answers.
Regards,
Mike

neutralfox -4 Junior Poster

Hello friends,
As usual .. when i have a problem ... daniweb.com is here ;). So I need some information from you. Ok, let me explain ... I am currently developing a chat application ! Ok ... everything works fine till now but I have doubts.

My application uses 3 ports, one for the general chat room, one for personal chat and one for file transfer. I have used 3 random ports .. 4321, 4532 and 4533.

Is there a standard port to used?

What will happen if I run this application on a computer where these 3 ports is in used?

And finally, how to know if a port is in used or not ?

Thanks a lot for your answers guys.

Regards,
Mike.

neutralfox -4 Junior Poster

Okie, thanks dude , its working.

The problem was with the link, I ve changed it to

http://whatismyip.com/automation/n09230945.asp

Now can you help me to set the timeout please.

neutralfox -4 Junior Poster

Hello,
I've modified the code and no more errors, but still I didn't get the IP, the program keeps running and nothing appears.

import java.net.*;
import java.io.*;
import javax.swing.JOptionPane;
public class GetIP {

    public GetIP() {
    

    }
        
        
        
         public static void main(String args[]) {
    	try{
    	
    	
    	java.net.URL URL = new java.net.URL("http://www.whatismyip.org/");
 
		java.net.HttpURLConnection Conn = (HttpURLConnection)URL.openConnection();
		 
		java.io.InputStream InStream = Conn.getInputStream();
		 
		java.io.InputStreamReader Isr = new java.io.InputStreamReader(InStream);
		 
		java.io.BufferedReader Br = new java.io.BufferedReader(Isr);
		 
		System.out.print("Your IP address is " + Br.readLine());
		JOptionPane.showMessageDialog(null, "IP is: " + Br.readLine() );
		
    	}catch(Exception e){e.printStackTrace();}
		
    	}
    
}
neutralfox -4 Junior Poster

Hello, thanks for the link, I have tried to run the code but I've got the following error:


Error:
C:\GetIP.java:8: cannot find symbol
symbol : class HttpURLConnection
location: class GetIP
java.net.HttpURLConnection Conn = (HttpURLConnection)URL.openConnection();
^
C:\GetIP.java:17: cannot find symbol
symbol : method readline()
location: class java.io.BufferedReader
System.out.print("Your IP address is " + Br.readline());
^
2 errors

Process completed.


Thanks a lot for the answer.

neutralfox -4 Junior Poster

Hello friends,
I am having a small problem, i have already designed a chat application, the chat works fine over a local network but now I want to use it over the internet. Logically the program should but what happened is that to get the IP I have used

clientInformation.clientIPAddress = clientsoc.getInetAddress().getHostAddress();

and it gives only the local and I want the public IP of that machine. Can someone help me please.

I just want to get the external IP in a textbox!!

Thanks a lot in advance for your help.
Regards
Mike

neutralfox -4 Junior Poster

WoW, thanks a lot for the answers guys. But I am having another problem, I want the user to input a string that can be used as the key but its not working.

byte[] raw =  "thekey".getBytes();

but i am having the following errors:
--------------------Configuration: <Default>--------------------
Exception in thread "main" java.security.InvalidKeyException: Invalid AES key length: 6 bytes
at com.sun.crypto.provider.AESCipher.engineGetKeySize(DashoA13*..)
at javax.crypto.Cipher.b(DashoA13*..)
at javax.crypto.Cipher.a(DashoA13*..)
at javax.crypto.Cipher.a(DashoA13*..)
at javax.crypto.Cipher.a(DashoA13*..)
at javax.crypto.Cipher.init(DashoA13*..)
at javax.crypto.Cipher.init(DashoA13*..)
at AES.main(AES.java:48)

Process completed.

Is there a way for me to allow someone to use a string as the key. If not how can I save the key.

Thanks a lot for your answers guys.

Regards,
Mike.

neutralfox -4 Junior Poster

Hello everyone,
I got a small question on encryption, actually I am trying to learn the various techniques to encrypt a message. Now I am trying AES, using the built in security package in Java. The problem is that I am having a problem with this encryption algorithm. Actually I've got a sample of the AES on the net and trying to understand the logic but I am stuck. Here's the code:

import java.security.*;
   import javax.crypto.*;
   import javax.crypto.spec.*;
   import java.io.*;


   public class AES {


     public static String asHex (byte buf[]) {
     	
      StringBuffer strbuf = new StringBuffer(buf.length * 2);
      int i;

      for (i = 0; i < buf.length; i++) {
       if (((int) buf[i] & 0xff) < 0x10)
	    strbuf.append("0");

       strbuf.append(Long.toString((int) buf[i] & 0xff, 16));
      }

      return strbuf.toString();
     }

     public static void main(String[] args) throws Exception {

       String message="AES still rocks!!";

       // Get the KeyGenerator
       KeyGenerator kgen = KeyGenerator.getInstance("AES");
       kgen.init(128); // 192 and 256 bits may not be available


       // Generate the secret key specs.
       SecretKey skey = kgen.generateKey();
       byte[] raw = skey.getEncoded();

       SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
       


       // Instantiate the cipher
       Cipher cipher = Cipher.getInstance("AES");



       cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
       byte[] encrypted = cipher.doFinal((args.length == 0 ? message : args[0]).getBytes());
       System.out.println("encrypted string: " + asHex(encrypted));

       cipher.init(Cipher.DECRYPT_MODE, skeySpec);
       byte[] original = cipher.doFinal(encrypted);
       String originalString = new String(original);
       System.out.println("Original string: " +   originalString + " " + asHex(original));
     }
   }

Questions:
What is the key in this program? How can I change the key?


Finally when I try the program, …

neutralfox -4 Junior Poster

Hello, thanks for the answer, I have not tested your solution, because I got the solution by myself.

Solution:
Move 0 in eax
push ax
mov ax, dx
Make 16 left shift in eax, to push ax to the end
pop ax
move ax, in eax

Voila.

Anyway, thanks for the answer dude.

neutralfox -4 Junior Poster

Hello,

I need a little help for word multiplication, according to my notes, to multiply a word, we should put the multiplicand in AX, the multiplier in a register or memory variable and the result should appears in AX(low) and DX(high).

The problem is how to get the product ? It is found in two seperate registers, how to merge them together.

This is a simple example:

call GetDec
		        mov bx, ax
                        dec bx
			cwd
			imul bx

From the example above, the product is in AX and DX but how to access the product and save it in a memory variable?

Thanks in advance for your answer.

neutralfox -4 Junior Poster

Hello everyone,
Someone recommend me to use Microsoft Macro Assembler 8, I have already installed it, together with Microsoft Visual C++ 2005 but I don't know how to use it.

Can someone guide me please, I tried to search some tutorial on the net but can't find for this program. I am a beginner to assembly language.

Thanks in advance.

neutralfox -4 Junior Poster

Okie , thanks for the fast reply. I will try it. Thanks a lot.

neutralfox -4 Junior Poster

Hello, just take a lot at the link above, I have already installed VC++ 2005 and Masm 8 but don't know how to use it. Can't someone please guide me, thanks in advance.

@r03395, download the online installer from softpedia. I am posting the link again:

http://www.softpedia.com/progDownload/Microsoft-Visual-C-Toolkit-Download-11595.html

Hope it helps.

neutralfox -4 Junior Poster

OK, I got it.. its here for those who are interested ... Once again, thanks a lot for your help.

http://www.softpedia.com/progDownload/Microsoft-Visual-C-Toolkit-Download-11595.html

I don't know if I have the right to paste external links over here but this link will surely help someone one day.

neutralfox -4 Junior Poster

Hello, thanks for the reply but:

They both have been initialized.

byte[] buffer=new byte[1024];
            int bytes=0;
neutralfox -4 Junior Poster

Ok .. Thanks a lot dude, you are right , masm32 is real good. But I want to try the Macro 8, still searching for Visual C++ 2005, anyway, thanks a lot, you have been of great help.


Btw, do you know where I could download Visual C++ 2005 ? Will it work with Visual C++ 2008?

Thanks.

neutralfox -4 Junior Poster

Yes ... the full code is in the attachement. I removed it from the code cause I am not dealing with this part yet.

The connectToServer is call as I saw the message in this method.

neutralfox -4 Junior Poster

Hello,
I am having a null pointer error, don't know where it came out. Can someone check this code for me please:

The error is in the sendBytes methods, I have put a comment over there, actually there are two null errors.

1.

pw.println(filenm);

2.

out.write(buffer,0,bytes);

Thanks a lot in advance.


This is the code:

import java.net.*;
import java.io.*;
import javax.swing.JOptionPane;


public class FTPClient implements Runnable {


Socket s;
long length;
File file;

	InputStreamReader in = null;
	OutputStream out = null;
	BufferedReader br = null;
	PrintWriter pw = null;

    String filenm  = null;
    String fn;

public FTPClient(){

}

public FTPClient(int port){
    connectToServer(port);
    new Thread( this ).start();
}

//connect to the server
public void connectToServer(int port){

   try{    
                s  = new Socket ("127.0.0.1" , port);
                br = new BufferedReader(new InputStreamReader(s.getInputStream()));
                pw = new PrintWriter(s.getOutputStream(),true);
                out = s.getOutputStream();

                JOptionPane.showMessageDialog(null, "Client says: ... I am connected and IO Ready!");

        }catch(Exception e){e.printStackTrace();}
}




//send bytes to server
public void sendBytes(File f){
     
        try{

            JOptionPane.showMessageDialog(null, "Client says: File send ....");
            JOptionPane.showMessageDialog(null, "Client says: The file name: " + f.getName());
            JOptionPane.showMessageDialog(null, "Client says: The file size: " + f.length());

            filenm = f.getName();
            pw.println(filenm);  // got a java.lang.NullPointerException here 
            FileInputStream fis = new FileInputStream(filenm);
            byte[] buffer=new byte[1024];
            int bytes=0;

            while((bytes=fis.read(buffer))!=-1)
            {
                out.write(buffer,0,bytes); // got a java.lang.NullPointerException here also when I comment //  pw.println(filenm);  the first one
                JOptionPane.showMessageDialog(null, "Test .... ");
            }

            fis.close();

        }catch(Exception e){e.printStackTrace();}

}



}

This is the error:

run-single:
java.lang.NullPointerException
at ignisftpv3.FTPClient.sendBytes(FTPClient.java:85)
at ignisftpv3.FTPClientInterface.btnSendActionPerformed(FTPClientInterface.java:121)

neutralfox -4 Junior Poster

Sorry ... I declared done at the top as a boolean value and set to true.

boolean done = true

Yes .. I compiled it,no errors, the program run ... but its seems to work but the program does not write the file.

And I can't see the output of this piece of code:

System.out.println(input.read(buffer,0,bytes));

I changed the EOF to -1, still nothing. I tried to write the buffer ... still nothing. Please help me on this part , thanks in advance.

neutralfox -4 Junior Poster

Hello,
I have changed the code, still not working, can you please check if its the right way to write to a file. Thanks a lot.

//read and write file
    public void run(){
 
        try{
            while(true){
                JOptionPane.showMessageDialog(null, "Server Receiver says: Incoming in progress ...");
                byte[] buffer = new byte[1024];
                int bytes = 0;
                input = new ObjectInputStream(thesocket.getInputStream());
                 //input.read(buffer,0,bytes);
                File f = new File(directoryName,"filetest");
                fout = new FileOutputStream(f);
                //fout.write(input.read(buffer,0,bytes));

                //new changes
                while(done){
                    if( (input.read(buffer,0,bytes)) == 0){
                        done = false;
                    }
                    else{
                        System.out.println(input.read(buffer,0,bytes));
                         fout.write(input.read(buffer,0,bytes));
                    }
                 }

            }

        }catch(Exception e){e.printStackTrace();}

        //JOptionPane.showMessageDialog(null, "Reception completed ...");

    }
neutralfox -4 Junior Poster

Hello,
I have just finished writing the code for my FTP application but according to my code, everything should work fine. But when I run my application, the file is not transfer to the server. Can someone please check where I am going wrong. I am sending the code as attachment.

Please Note: I only want the Client to send a file to the Server for the time being.

Thanks in advance ...

neutralfox -4 Junior Poster

For the chat section ... I will post the code later on. I don't want other students to copy my code. But for the FTP, Encryption I can, because lecturers will marked only the chat section, which I have already completed, I want to add "extras" for me to score maximum marks and for self satisfaction. And if I got time, I will try to implement database also.

neutralfox -4 Junior Poster

I have completed the chat section. The chat section works perfectly, with hard work and with your help(thanks a lot). Now, I want to integrate FTP in it and also encryption of message.. I am coding the FTP separately first, to understand the concept, then I will integrate it in the chat and finally I will work on the encryption part.

neutralfox -4 Junior Poster

Yes ... I have already read these links before posting. For example in my chat application, which design pattern I must use(if any), just an example please. Because I have read some of the design patterns and I am asking myself "Where can I use these things?". I want to make my application more professional.

Thanks for the answer !!

neutralfox -4 Junior Poster

Hello everyone,
I just fall on an article on design patterns. They said that if you want to become a good programmer, you must follow design patterns. But till now I have never follow these patterns. I don't even know how to use design patterns, they said that there are 23 in total but how to use them and where to use design pattern? Please take the case of a chat application, for me to understand it well.

Thanks a advance.

neutralfox -4 Junior Poster

Yeppp, we never stop to learn. Thanks a lot for all your help ... GMT+4 and you.

neutralfox -4 Junior Poster

Okie .... thanks for the help. I will try it.

neutralfox -4 Junior Poster

Thanks ... will the program still run in masm615 if I assembled it using masm32?

neutralfox -4 Junior Poster

Thanks a lot James, I followed your instructions and its working fine. I've just separated the user interface from the business logic. But still can't understand the logic, I will not mark this thread as solve yet as I got some questions.

Thanks a lot.

neutralfox -4 Junior Poster

Thanks for the answer dude. But I am having problem to install masm32. Is it different from masm615?

neutralfox -4 Junior Poster

I am using masm615 and Windows XP. But I didn't know that the code depends on the OS and the compiler.

neutralfox -4 Junior Poster

Okie .. thanks for the answers James, I will work it out and let you know if I am having any problems, thanks for the info BJSJC. ;)

neutralfox -4 Junior Poster

Thanks for the info, but my problem is still unsolved.. can't get it to work.

neutralfox -4 Junior Poster

Hello friends,
I am new to assembly language and I want the user to input a string ... then save the string in a stack.

Is there a function to get the string from the user, like getStr .

Thanks in advance.

neutralfox -4 Junior Poster

Its OK ... thanks.