Skip to content

Instantly share code, notes, and snippets.

@rickolous
rickolous / sd_upgrade.sh
Created March 28, 2020 20:40
boot.sh from eWeLink FGHGF VG-IC-01 IP Camera
echo ""
echo "----enter to upgrade from sdcard----"
bUpgrade=0
if [ ! -f /var/sdcard ];then
mkdir /var/sdcard
mount /dev/mmcblk0p1 /var/sdcard
fi
cp /gm/tools/flashcp /usr/bin/
chmod +x /usr/bin/LEDLamp.sh
import requests
# The First thing that we need to do is read the version file and extract the build number and version number
version_info = (open("filesystemversion", "r+").read()).strip()
length_of_version_info = len(version_info)
build_number = version_info[version_info.find("b"):]
version_number = version_info[:length_of_version_info-len(build_number)]
print("Version Info: {0}".format(version_info))
print("Build Number: {0}".format(build_number))
print("Version Number: {0}".format(version_number))
@rickolous
rickolous / boot.sh
Created March 7, 2020 19:17
boot.sh from eWeLink FGHGF VG-IC-01 IP Camera
home=/mnt/mtd
export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/gm/bin:/gm/tools
read -t 2 -p "loading image" exit_boot
if [ "$exit_boot" == "e" ] ; then
exit
fi
mknod /dev/gk_video -m 666 c 248 0
mknod /dev/gk_log -m 666 c 248 249
mknod /dev/gk_fw -m 666 c 248 1
mknod /dev/debug -m 666 c 248 248
@rickolous
rickolous / endian_converter.py
Last active January 2, 2020 21:05
Script that converts the endianness of the memory dumped by md display
input_handler = open("hex_numbers.txt", "r+").readlines()
output_handler = open("device_memory.txt", "w+")
for hex_codes in input_handler:
hex_codes = hex_codes.strip()
characters = [chr(int(hex_codes[x:x+2], 16)) for x in range (0, len(hex_codes), 2)]
converted_endian_output = "".join(["".join(characters[x:x+4])[::-1] for x in range (0, len(characters), 4)])
output_handler.write(converted_endian_output)
output_handler.close()
@rickolous
rickolous / view_state_form.html
Created May 7, 2018 16:38
View State Example Form
<html>
<body>
<form action="http://slack.com/fakevotingservice" method="POST">
<input type="hidden" name="grey&#95;type" value="grey" />
<input type="hidden" name="javax&#46;faces&#46;ViewState" value="631669508271731252&#58;4668721254263228340" />
<input type="submit" value="Submit request" />
</form>
</body>
</html>
public class ViewstateCracker {
/* START PART 1 */
public static final int offset = 32;
public static final int iterations = 65536;
public static final String generateNewViewstate(final long idInLogicalMap, final long idInActualMap) {
final long first32BitsOfIdInLogicalMap = idInLogicalMap >>> offset;
final long second32BitsOfIdInLogicalMap = ((idInLogicalMap << offset) >>> offset);
final long first32BitsOfIdInActualMap = idInActualMap >>> offset; // Verification
final long second32BitsOfIdInActualMap = ((idInActualMap << offset) >>> offset); // Verification
@rickolous
rickolous / underTheHood.java
Created May 2, 2018 00:32
Abstracted Random Number Generation Process
Random rnd = new Random();
rnd.setSeed(seed);
/*
public void setSeed(seed) {
(seed ^ 0x5DEECE66DL) & ((1L << 48) - 1)
}
*/
rnd.nextLong();
@rickolous
rickolous / ServerSideStateHelper.java
Created May 1, 2018 21:55
ServerSideStateHelper.java Source
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2014 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
def main():
print("test")