Skip to content

Instantly share code, notes, and snippets.

--libdetector Demo
--A product of Advanced Mesecons Devices, a Cheapie Systems company
--This is free and unencumbered software released into the public domain.
--See http://unlicense.org/ for more information
local libdetector = {
pre_hook = function()
if event.type == "program" then
mem.__libdetector_registered = {}
end
--libexpander
--A product of Advanced Mesecons Devices, a Cheapie Systems company
--This is free and unencumbered software released into the public domain.
--See http://unlicense.org/ for more information
local libexpander = {
pre_hook = function()
if event.type == "program" then
mem.__libexpander_registered = {}
end
--Light Controller 2
--A product of Advanced Mesecons Devices, a Cheapie Systems company
--This is free and unencumbered software released into the public domain.
--See http://unlicense.org/ for more information
local MODE_OFF = 0
local MODE_ON = 1
local MODE_DUSKDAWN = 2
local MODE_DAWNDUSK = 3
local MODE_GAMETIME = 4
# hdparm -I /dev/sda
/dev/sda:
ATA device, with non-removable media
Model Number: ST14000NM0007-2G8101
Serial Number: ZCH06S08
Firmware Revision: SN01
Transport: Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
# smartctl -x /dev/sdb
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.14.0-1-amd64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Device Model: ST18000NM000J-2TV103
Firmware Version: SN02
User Capacity: 18,000,207,937,536 bytes [18.0 TB]
Sector Sizes: 512 bytes logical, 4096 bytes physical
Rotation Rate: 7200 rpm
# smartctl -x /dev/sda
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.14.0-1-amd64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Device Model: ST14000NM0007-2G8101
Serial Number: ZCH06S08
LU WWN Device Id: 5 000c50 0a49564a2
Firmware Version: SN01
User Capacity: 14,000,519,643,136 bytes [14.0 TB]
$ sudo ./openSeaChest_FormatUnit_dbg -d /dev/nvme0n1 --showSupportedFormats
==========================================================================================
openSeaChest_Format - openSeaChest drive utilities - NVMe Enabled
Copyright (c) 2014-2021 Seagate Technology LLC and/or its Affiliates, All Rights Reserved
openSeaChest_Format Version: 2.3.1-2_2_4 X86_64
Build Date: Sep 24 2021
Today: Fri Sep 24 13:50:47 2021 User: root
==========================================================================================
Attempting to open handle "/dev/nvme0n1"
get_Device: Getting device for /dev/nvme0n1
This file has been truncated, but you can view the full file.
start: 0x000000000, len 0x080000, cap 0x080000, wptr 0x000000 reset:0 non-seq:0, zcond: 0(nw) [type: 1(CONVENTIONAL)]
start: 0x000080000, len 0x080000, cap 0x080000, wptr 0x000000 reset:0 non-seq:0, zcond: 0(nw) [type: 1(CONVENTIONAL)]
start: 0x000100000, len 0x080000, cap 0x080000, wptr 0x000000 reset:0 non-seq:0, zcond: 0(nw) [type: 1(CONVENTIONAL)]
start: 0x000180000, len 0x080000, cap 0x080000, wptr 0x000000 reset:0 non-seq:0, zcond: 0(nw) [type: 1(CONVENTIONAL)]
start: 0x000200000, len 0x080000, cap 0x080000, wptr 0x000000 reset:0 non-seq:0, zcond: 0(nw) [type: 1(CONVENTIONAL)]
start: 0x000280000, len 0x080000, cap 0x080000, wptr 0x000000 reset:0 non-seq:0, zcond: 0(nw) [type: 1(CONVENTIONAL)]
start: 0x000300000, len 0x080000, cap 0x080000, wptr 0x000000 reset:0 non-seq:0, zcond: 0(nw) [type: 1(CONVENTIONAL)]
start: 0x000380000, len 0x080000, cap 0x080000, wptr 0x000000 reset:0 non-seq:0, zcond: 0(nw) [type: 1(CONVENTIONAL)]
start: 0x000400000, len 0x080000, cap 0x080000, wptr 0x000000
local f = io.open("/proc/sys/vm/drop_caches","w")
f:write("3")
f:close()
local f = io.open(arg[1],"rb")
local devsize = f:seek("end")
local function seek(pos)
local byte = devsize*pos
f:seek("set",math.floor(math.min(devsize,byte+math.random(0,1000000000))))
local f = io.open(arg[1],"rb")
local devsize = f:seek("end")
local actmode = 1
local actregion1 = 0
local actregion2 = 0
while true do
if actmode == 1 then
f:seek("set",math.random(0,devsize/30))