What is it that you want this method to actually do?

I'm trying to find the memory address of specific memory in a program. And as for the stuff you mentioned, I'm going to change the class.

Hi, I've already posted a thread about this on stackoverflow, but nobody has said anything useful, and it's been a day since it has been posted. I'm trying to scan for a memory address in a targeted process, but it goes really really slow. Either that, or there's something wrong with my function, because it has never returned. This is my memory editing class,

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;

namespace Black_Downloader
{
    class MemoryEditor
    {
        public const uint DELETE = 0x00010000;
        public const uint READ_CONTROL = 0x00020000;
        public const uint WRITE_DAC = 0x00040000;
        public const uint WRITE_OWNER = 0x00080000;
        public const uint SYNCHRONIZE = 0x00100000;
        public const uint END = 0xFFF;
        public const uint PROCESS_ALL_ACCESS = (DELETE | READ_CONTROL | WRITE_DAC | WRITE_OWNER | SYNCHRONIZE | END);

        public Process targetedProcess;

        [DllImport("kernel32.dll")]
        public static extern int OpenProcess(uint dwDesiredAccess, bool bInheritHandle, int dwProcessId);

        [DllImport("kernel32.dll")]
        public static extern bool ReadProcessMemory(int hProcess, int lpBaseAddress, byte[] buffer, int size, int lpNumberOfBytesRead);

        [DllImport("kernel32.dll")]
        public static extern bool WriteProcessMemory(int hProcess, int lpBaseAddress, byte[] buffer, int size, int lpNumberOfBytesWritten);

        public Process targetProcess(string name, int index = 0)
        {
            return (targetedProcess = Process.GetProcessesByName(name)[index]);
        }

        public int getHandle(Process proc, uint access = PROCESS_ALL_ACCESS)
        {
            return OpenProcess(access, false, proc.Id);
        }

        public byte[] getBytesFromString(string str)
        {
            return Encoding.Unicode.GetBytes(str);
        }

        public string getStringFromBytes(byte[] byteArr)
        {
            return Encoding.Unicode.GetString(byteArr);
        }

        public int makeHex(string str)
        {
            return (int.Parse(str, System.Globalization.NumberStyles.HexNumber));
        }

        public byte[] ReadMemory(int address, int processSize)
        {
            byte[] buffer = new byte[processSize];
            ReadProcessMemory(getHandle(targetedProcess), ...

Sorry if wrong section, I don't know where else to make the thread. How would I start in developing a addon? Thanks guys.

Sorry for that post, I can't edit it. Anyways, I'm doing this function right here that gets it but it returns 0 every time?

public int ReadInt32(IntPtr hProcess, IntPtr dwAddress)
{
    byte[] buffer = new byte[4];
    int bytesread;
    ReadProcessMemory(hProcess, dwAddress, buffer, 4, out bytesread);
    return BitConverter.ToInt32(buffer, 0);
}

And here's the way I'm using it

        textBox1.Text = me.ReadInt32(this.Handle, me.GetBuffer(this.Handle).BaseAddress).ToString();

The second parm is from the MEMORY_BASIC_INFORMATION structure. You must first call OpenProcess and then call GetSystemInfo The lpMinimumApplicationAddress is used as an input to VirtualQueryEx which returns the Memory_BASIC_INFORMATION structure which is used in your ReadProcessMemory function call. In very simple terms, lpBaseAddress is where the executable loads in memory.

Thanks. I still have tons of errors, and I don't know why though. This is the class I made so far, and I get errors at ReadMemory function.

public SYSTEM_INFO GetInfo()
{
    SYSTEM_INFO sysinfo = new SYSTEM_INFO();
    GetSystemInfo(out sysinfo);
    return sysinfo;
}

public MEMORY_BASIC_INFORMATION GetBuffer(IntPtr ProcessHandle)
{
    MEMORY_BASIC_INFORMATION ret;
    VirtualQueryEx(ProcessHandle, GetInfo().lpMinimumApplicationAddress, out ret, (uint)Marshal.SizeOf(typeof(MEMORY_BASIC_INFORMATION)));
    return ret;
}

public string ReadMemory(Process Process, IntPtr ProcessHandle)
{
    byte[] buffer = new byte[Process.VirtualMemorySize64];
    ReadProcessMemory(ProcessHandle, GetBuffer(ProcessHandle), buffer, Process.VirtualMemorySize64, out 0);

    return "";
}

How can I read memory from a selected process? I'm using the ReadProcessMemory function and I don't understand the 2nd parameter (lpBaseAddress). Could anyone help me with this, or tell me another way to read memory from a process?

This is my function for reading memory, which I pulled off of Google.

    public int ReadInt32(IntPtr hProcess, IntPtr dwAddress)
    {
        byte[] buffer = new byte[4];
        int bytesread;

        ReadProcessMemory(hProcess, dwAddress, buffer, 4, out bytesread);

        return BitConverter.ToInt32(buffer, 0);
    }

I know what binary is, and I know what a CPU does. My question is how. How does a CPU work?

@Skata

I've looked at this before, and it looks nice, but does it include receiving the actual sent data? If it is easy enough to follow the source code, I can probably make that function myself, when I browse it tomorrow. Thanks for the link.

How would I be able to get all incoming packets, in C#? I have absolutely no idea on how to get started, so could you guys help me out? Thanks.

Hi, how does a CPU know that 1 + 1 = 2? It's a question that I've been thinking about since about today, and I have no clue how it knows.

Thanks, guys.

Does anyone know? This seems like it's pretty easy.

Hi, how would I make the webbrowser control, so it doesn't even accept cookies?

Thanks in advance, glut.

Solved. Thank you, what you said worked.

Hey, I'd like to read a file from the server, by any means necessary. As long as I can use something like JavaScript, like it has to be client sided. No server sided scripting language. If there is no way to read a file from the server, is there a way to read from client's computer?

Thanks, Glut.

[QUOTE=cereal;1738750]This will display user IP:
[code]<?php echo $_SERVER['REMOTE_ADDR']; ?>[/code]
Then use GD library or imagemagick to create an image from that text, for example with imagemagick from command line it will be:
[code]<?php
$ip = $_SERVER['REMOTE_ADDR'];
exec("convert -pointsize 30 -label '$ip' image.gif");
?>[/code]
Anyway a section for .htaccess is in Hardware & Software » Linux & Unix » Linux Server & Apache. Bye :)[/QUOTE]

Thank you for both of your posts. This isn't done with PHP, though.
[URL="http://www.danasoft.com/vipersig.jpg"]
Here[/URL] is an image that shows you your IP. Is there any way to do it as a image?

Hey, I don't know if this is the right section, but there's no HTAccess section, so I'll just put it here. Anyways, I'd like to make one of those signatures that gets the IP of the person and then makes and image out of it with the IP. I think the only way to do this is with HTAcces, by making a new image with the persons IP. Is there anyway to do this? Thanks.

[QUOTE=phoenix911;1732569]I agree with MikeyIsMe, use the MouseClick event.

But then again, not knowing what the OP wants..[/QUOTE]

Getting it globally. I'll try Thread.Sleep(100); and get back to you guys. Thanks :)

Hello. I have a really weird problem. Whenever I try to get if the user pressed down on the mouse (clicked), via GetAsyncKeyState(), it only shows it some times. I tried the exact same code, but with another key Ex: A, and it works fine.

Here is the code.

[CODE]
public void GetMouse()
{

        foreach (System.Int32 i in Enum.GetValues(typeof(Keys)))
        {
            XPos.Add((ushort)Cursor.Position.X);
            YPos.Add((ushort)Cursor.Position.Y);

            int pressed = GetAsyncKeyState(i);

            if ((pressed == -32767))
            {
                if ((i == 1) || (i == 2))
                    Click.Add((ushort)i);
                else
                    Click.Add(0);
            }
            else
                Click.Add(0);
        }
    }

[/CODE]

This goes through a loop, so it is always checking.
Oh, and also I've tried this on multiple windows, and such, and it still doesn't work.

Thank you so much, Glut.

[QUOTE=Fest3er;1728868]Works on Linux with a known file, running it from a shell. Change the open statement to
[code]
open(INFO, $file) || die "No such file '$file':"; # Open the file
[/code]
Also run it from a command line; you should see the errors:
[code]
perl -w myscript.pl
[/code]
Finally, double-clicking it mayn't give perl a place to send the output.[/QUOTE]

Thank you for teaching me how to open it properly. I get a error now too, thanks to -w.

"readline() on closed filehandle INFO at testperl.pl line 4." Line 4 is @lines = <INFO>; BTW. Oh, and also I added the || die('Error'); and it didn't show anything, so isn't the file that can't be opened. Oh, and also I made a new file as a text file, and it didn't open.

Thanks so much.

Hello. I have a severe problem with open(). Here is my actual code.

[ICODE]

!/usr/bin/perl

$file = '/testerpage.php';      # Name the file
open(INFO, $file);      # Open the file
@lines = <INFO>;        # Read it into an array
close(INFO);            # Close the file
print @lines;           # Print the array

<>;
[/ICODE]

I copied exactly from a website, but renamed the file to one that exists.

[B]Some specs:[/B][LIST=1]
[LIST]
[]Windows 7 Ultimate 64 bit
[
]Latest version of Notepad++
[]Perl 5
[
]Opened it by double clicking
[/LIST][/LIST]

Thanks for the help, Glut.

Hey, I have a question on fwrite. I know that fwrite can write things to your server, for instance, but when I put try to write C:\foo.txt, will this actually save it to my server, or to the clients computer? If not, then is there any way that I can save it on the clients computer?

Thank you, glut.

Hey, I'm currently using mysql_real_escape_string() to protect against SQL injection. Is there a way to exploit this? I have already tried \ to try to make the query \', thus making it just a regular backslash. I have heard of the Big5 exploit, but I don't know how to use it / protect against it.

Thanks so much, Glut.

[QUOTE=ardav;1718666]I think the Big5 exploit is for db using charset Big5. So, if you're not using Big5, you probably won't need to worry about it.

The mysql_real_escape_string() should escape the backslash and escape the single quote again, so \' becomes \\'. Can't see why this isn't working for you.[/QUOTE]

Oh, that's why the Big5 exploit didn't work. So, if I'm not using Big5 character encoding, will the mysql_real_escape_string() still work against all SQL injection attacks for my website?

Hey, I'm currently using mysql_real_escape_string() to protect against SQL injection. Is there a way to exploit this? I have already tried \ to try to make the query \', thus making it just a regular backslash. I have heard of the Big5 exploit, but I don't know how to use it / protect against it.

Thanks so much, Glut.

Hey, I need to clean up my computer, I have a lot of malware on it probably. I need to know what tools I should use to clean it up. I have already installed Avira, MBAM, SAS. It's so easy for malware to go FUD for all of these, so I don't know if these are any good or not.

Anyways, what tools should I use to remove malware?

[QUOTE=JamesCherrill;1702644]Yes they can, but if you don't display it or save it what are you going to do with it?[/QUOTE]

Eventually I am going to draw it to the screen, but I want to manipulate it before and after displaying it :)

[QUOTE=JamesCherrill;1702616]Read the first into a buffered image, get that image's Graphics2D, draw the second image on to it. You'll find the documentation in the usual places.

(but, I still don't understand what you're going to do with this in an applet if you don't display it on the screen?)[/QUOTE]

Thank you, you're the first one on this thread that actually tried to help. And what are you saying about the applets? Can applets not do this?

[QUOTE=JamesCherrill;1702454]Do you mean join side-by-side, or overlay one image on top of the other?[/QUOTE]

Not side by side really. I have 2 transparency enabled PNGs where one image is on top of the other(overlayed)

[QUOTE=hfx642;1702528][I]"...but I don't want to draw it to the screen, and I don't want to save it to a file."[/I]
Well... What's the point???[/QUOTE]

It's an applet, so I can't save to their computer, unless it's a drive-by, which it isn't.

Hey, DW. I really need to know how to combine two images, into one image, but I don't want to draw it to the screen, and I don't want to save it to a file. It should look something like this

[CODE]
Image img1 = new ImageIcon("C:\flying.png").getImage();
Image img2 = new ImageIcon("C:\foo.png").getImage();

Image combined = img1 + im2;
[/CODE]

Thanks so much you guys :)