Skip to content

Instantly share code, notes, and snippets.

@knowlet
Created June 11, 2019 06:29
Show Gist options
  • Save knowlet/12d170c11c870c3b98ad9b37735ddfc4 to your computer and use it in GitHub Desktop.
Save knowlet/12d170c11c870c3b98ad9b37735ddfc4 to your computer and use it in GitHub Desktop.
Fake Realtek apmib library.
// mips-linux-gnu-gcc -Wall -fPIC -shared apmib.c -o apmib-ld.so
#include<stdio.h>
#include<stdlib.h>
#define MIB_IP_ADDR 170
#define MIB_HW_VER 0x250
#define MIB_CAPTCHA 0x2C1
int apmib_init(void) {
// Fake it!
return 1;
}
void apmib_get(int code, int *value) {
switch(code) {
case MIB_HW_VER:
*value = 0xF1;
break;
case MIB_IP_ADDR:
*value = 0x7F000001;
break;
case MIB_CAPTCHA:
*value = 1;
break;
}
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment