Questions tagged [self-modifying]

Self-modifying code is a piece of software which achieves its goal by rewriting itself as it goes along. Use this tag for questions related to self-modifying code, such as the writing and running of such codes in different languages, use cases and its detection.

Self-modifying code is a piece of software which achieves its goal by rewriting itself as it goes along. Use this tag for questions related to self-modifying code, such as the writing and running of such codes in different languages, use cases and its detection.

156 questions
1
vote
1 answer

Get the address of an intrinsic function-generated instruction

I have a function that uses the compiler intrinsic __movsq to copy some data from a global buffer into another global buffer upon every call of the function. I'm trying to nop out those instructions once a flag has been set globally and the same…
Arush Agarampur
  • 1,340
  • 7
  • 20
1
vote
1 answer

Why can I not rewrite in a list in Erlang?

I have a list L = [1,2,3]. I perform the following on L: lists:sublist(L,2) ++ [10] ++ lists:nthtail(3,L). Instead of storing the result in a new list, I want to store the result in L itself. However, when I do so, I am getting the obvious error:…
Manika Sharma
  • 113
  • 1
  • 12
1
vote
0 answers

how can I change modular code to OOP design?

I am trying to porting this sample of self-mutation of c to c++, but i am having problems with pointers to make it work this example for c++ OOP. I have changed this the part of displaying the data , but how can I change the rest of pointers? aa.h…
cyb3rpunk
  • 61
  • 7
1
vote
0 answers

VBA MACRO that can edit itself while running?

I am trying to see if it is possible to have a macro edit itself in a permanent way. From what I have found on the internet it is potable to do something with the macro but I am unsure if I can do something more permanent. The Idea is this. I have a…
Mike - SMT
  • 14,784
  • 4
  • 35
  • 79
1
vote
0 answers

Is there a better way to implement a constraint satisfaction solver than a preprocessor that generates a Rust program?

I'm writing a constraint satisfaction solver that will read an input file with multiple functions such as and(not_equal(X0,X1),not_equal(absolute(subtract(X2,X3)),X4)) The solver will try 100s to 100,000,000s of combinations of X1, X2, X3, X4, X5…
HiDefender
  • 2,088
  • 2
  • 14
  • 31
1
vote
0 answers

Python 3 - Automatically put file under pressed cursor for dragging into other application

I want to write a workflow improving script for an application I use. The issue is the target application is only accepting files that are moved onto it via drag and drop. The Source from where I am dragging is though not dragging the actual file…
subsonics
  • 11
  • 1
1
vote
3 answers

copy and call function

I'd like to copy and call a function, but the code below segfaults when calling the buffer. What do I have to change? (Linux, x86) #include #include #include int foo () { return 12; } void foo_end () {} int main ()…
Thomas
  • 1,001
  • 1
  • 10
  • 20
1
vote
2 answers

Self Modification of .exe c file after execution

I have a c code with a character array initialized to "hello world". I would like to know if there is a possibility to re-initialize this character array upon each execution of the code, to some other random string. If not C, may I know if such an…
1
vote
0 answers

OS, modifiable from the inside

Is there any minimal open source OS which can be modified from the inside when running? In educational purposes. I would like something like a built-in WYSIWYG editor with a reload modified system module button and an option to run with previous…
1
vote
2 answers

Self-Modifying MIPS Code

I'm trying to write a program in MIPS that continuously prompts for two integers and prints the sum until the sum is 0. The trick is that if the sum is 13, I need to call a method to change the assembled MIPS code so that add $t2, $t0,…
Nick Gilbert
  • 4,159
  • 8
  • 43
  • 90
1
vote
1 answer

Why is this assembly code not modifing itself

I wanted to see if self-modifying code in assembly is possible, since .text is read-only I thought I could put the code in .data instead, I tried the code below. section .text global _start ;must be declared for…
Alice Ryhl
  • 3,574
  • 1
  • 18
  • 37
1
vote
1 answer

programmatically decide which style attribute to modify in javascript

I have a situation where, depending on a variable value, I will want to modify EITHER the margin-top OR margin-bottom property of a div. Apart from using an "if else", is there any way of doing it kinda like this : var…
Chris Jones
  • 405
  • 1
  • 6
  • 17
1
vote
1 answer

Android Self-modifying code - NDK

I am trying to make a self-modifying code library and I have scowered all over and I have the follow code: typedef int (*FUNC) (void); int test(); JNIEXPORT int Java_com_example_untitled_MyActivity_decrypt( JNIEnv* env, jobject thiz) { void…
Thomas
  • 1,401
  • 8
  • 12
1
vote
2 answers

Self modifying code in node.js, would cluster work?

I am asking this since I don t have the tool or time to test this right now, but the idea is bothering me. I ll answer this myself when I ll have the time to play with it. In node.js, how does require() work? Does it keep the required function in…
DrakaSAN
  • 7,673
  • 7
  • 52
  • 94
1
vote
1 answer

Self modifying code in c

Is there a way to make code modify itself every time it is run. By this i mean adding new functions and modifying existing functions. For example if i have a c program that runs a specific function that checks to see if a file exists can i modify…
user2626335
  • 121
  • 2
  • 9