code-injection

Having trouble with microsoft detours

此生再无相见时 提交于 2019-12-06 13:36:55
问题 I'm trying to do some basic hooking with microsoft detours and I can't get it to work. I've used essentially the code that was posted in this thread: How can I hook Windows functions in C/C++? but no dice. I updated the send/receive functions in the DLL code to simply log the data to a file, and I tried having the main program hook into the "internet checkers" program, but a log file never gets created, so it appears that the dll wasn't injected. I'm running Windows 7 64-bit, Visual Studio 10

Dll injection. Execute CreateRemoteThread with parameter

北慕城南 提交于 2019-12-06 13:23:03
I wrote dll injection program that works just fine. It loads dll into remote process and calls some function. Now i want to pass argument to that function. CreateRemoteThread has lpParameter for that, but how to get that passed argument inside dll to use it in function? Update : dll entry point is common: BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) Dll contains only one function with following prototype: void TestFunction(const char* ua); Code that calls that function is: CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)((void*

Interact with Flash using Python Mechanize

限于喜欢 提交于 2019-12-06 13:18:05
I am trying to create an automated program in Python that deals with Flash. Right now I am using Python Mechanize, which is great for filling forms, but when it comes to flash I don't know what to do. Does anyone know how I can interact with flash forms (set and get variables, click buttons, etc.) via Python mechanize or some other python library? Yuda Prawira Nice question but seems unfortunately mechanize can't be used for flash objects jdi What you probably want to search for is how to control javascript in a page via python, which can control flash that was specifically designed to accept

Prevent injection SQL with PHP [duplicate]

£可爱£侵袭症+ 提交于 2019-12-06 12:42:13
This question already has answers here : How can I prevent SQL injection in PHP? (28 answers) Closed last year . Since my statements are like "SELECT * FROM `box` WHERE `thing` = '{$variable}' Could I clean that with simply $variable = str_replace("'","\'",$variable); "SELECT * FROM `box` WHERE `thing` = '{$variable}' Would that work? My host doesn't support mysql escape and I'm not using mysqli. Depending on what classes as a valid data type for your query, you can usually get away with: function cleanVar($str){ $str = strip_tags(addslashes($str)); return $str; } Use parametrized queries (PDO

With dropwizard validation, can I access the DB to insert a record

不羁的心 提交于 2019-12-06 12:39:58
问题 My problem is the following: I am using dropwizard for a project and I have used the validation framework happily and successfully so far. My validation works fine and it is used in the standard way. This is what I have: Request class: import javax.validation.constraints.NotNull; import MandatoryFieldLengthCheck; public class InitiatePaymentRequest implements PaymentRequest { @NotNull(message = "Mandatory input field missing") @MandatoryFieldLengthCheck(value = 32) protected String

Injecting a managed dll into a native process

[亡魂溺海] 提交于 2019-12-06 12:12:29
I'm trying to inject a managed c# dll into a native executable. I'm injecting the following code into the executable in order to load the CLR. I know the injection works, because when I inject the code into cmd.exe it outputs correctly. I know that CLRCreateInstance, pMetaHost->GetRuntime, pRuntimeInfo->GetInterface all return S_OK, but pClrRuntimeHost->Start() returns E_FAIL. This only happens when I inject the dll into a remote process. If I load the dll on my own process and call Main from there, all calls return S_OK and the managed code runs fine. Update: I've tried injecting the code

PostSharp - How to inject a method into a class?

淺唱寂寞╮ 提交于 2019-12-06 11:56:08
I have some problem with PostSharp (I assume that problem can be solved by other library). I have that scenario: I must get all classes with name containing a word, e.g "Sth". I have that classes in my project (an example): SthClass1.cs SthClassBlabla.cs SthClass3.cs and I find that classes using PostSharp : [assembly: TraceAttribute( AttributeTargetMembers = "Sth*")] then, is it possible to inject (using aspect, PostSharp (?)) code for each found class ? example: SthClass1 myObj = new SthClass1(); myObj.ClassMethod1(); myObj.ClassMethod2(); myObj.InjectedMethod(); //that method belongs to the

Problems on injecting into printf using LD_PRELOAD method

这一生的挚爱 提交于 2019-12-06 10:14:11
I was hacking printf() of glibc in one of my project and encountered some problem. Could you please give some clues? And one of my concern is why the same solution for malloc/free works perfect! As attached, “PrintfHank.c” contains my own solution of printf() which will be preloaded before standard library; and “main.c” just outputs a sentence using printf(). After editing two files, I issued following commands: compile main.c gcc –Wall –o main main.c create my own library gcc –Wall –fPIC –shared –o PrintfHank.so PrintfHank.c –ldl test the new library LD_PRELOAD=”$mypath/PrintfHank.so” $mypath

Given the my code is open source and I'm running on a server, and I accept nearly-raw code, what's the worst that can happen to me?

浪尽此生 提交于 2019-12-06 07:53:37
问题 I'm looking at several cases where it would be far, far, far easier to accept nearly-raw code. So, What's the worst you can do with an expression if you can't lambda, and how? What's the worst you can do with executed code if you can't use import and how? (can't use X == string is scanned for X) Also, B is unecessary if someone can think of such an expr that given d = {key:value,...}: expr.format(key) == d[key] Without changing the way the format looks. 回答1: The worst you can do with an

Are Cookies a Security Risk?

感情迁移 提交于 2019-12-06 07:01:58
问题 Assume we have a website that asks the user for his name. The website then stores this value in a cookie, and on the next page, retrieves it via PHP and uses it somehow (perhaps the page displays the name as text). Could a user modify the cookie data to inject malicious code? Should cookie data be sanitized as it's retrieved by the script? (This is a hypothetical scenario. Obviously a cookie wouldn't be necessary here.) 回答1: Could a user modify the cookie data to inject malicious code? Should