星空网 > 软件开发 > Java

Atitit. 注册表操作查询 修改 api与工具总结 java c# php js python 病毒木马的原理

Atitit. 注册表操作查询 修改 api与工具总结 java c# php js python 病毒木马的原理

 

 

1. reg 工具

这个cli工具接口有,优先使用,jreg的要调用dll了,麻烦的..

2. Jreg 框架

Jreg的要调用dll了,麻烦

 

作者::  ★(attilax)>>>   绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 汉字名:艾龙,  EMAIL:1466519819@qq.com

转载请注明来源: http://www.cnblogs.com/attilax/

 

3.  1,查询所有子项和值   by reg


D:\>reg query hklm\software\TTT

! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\software\TTT
Name REG_SZ TTT BLOG
EMail REG_SZ taoether@gmail.com
URL REG_SZ http://www.taoyoyo.net/ttt/
Type REG_DWORD 0x2

  2,查询特定项

D:\>reg query hklm\software\ttt /v url

! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\software\ttt
url REG_SZ http://www.taoyoyo.net/ttt/

  这里最难的是如何取得我们想要的字符串呢,困惑了好长时间,终于找到方法了。
  原来也没有别的好办法,只能用find,for循环来截取我们需要的内容。(下面的例子如果看不懂,请参考本博客另外的文章:DOS循环-bat/批处理for命令详解之二)
  例如我们要得到url的键值: http://www.taoyoyo.net/ttt/,可以用以下脚本:

复制代码 代码如下:


  @ECHO OFF
  for /f "tokens=1,2,3,4,*" %%i in ('reg query "HKEY_LOCAL_MACHINE\software\ttt" ^| find /i "URL"') do SET "pURL=%%k"
  echo TTT BLOG的URL值为:%pURL%

 

4. Code  by jreg

package aaaAddr;

 

import java.util.List;

import java.util.Map;

 

import jdk.nashorn.internal.ir.Terminal;

 

import com.attilax.json.AtiJson;

import com.attilax.lang.YamlAtiX;

import com.attilax.lang.text.strUtil;

import com.google.common.collect.Lists;

import com.google.common.collect.Maps;

import com.registry.RegistryKey;

import com.registry.RegistryValue;

 

/** aaaAddr.SysServiceUtil.getList

 * @author digdeep@126.com

 */

public class SysServiceUtil {

// "HKEY_LOCAL_MACHINE"

public static final RegistryKey LOCALMACHINE = RegistryKey

.getRootKeyForIndex(RegistryKey.HKEY_LOCAL_MACHINE_INDEX);

 

// "HKEY_LOCAL_MACHINESystemCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp"

public static final RegistryKey rdpKey = null;

 

// = new RegistryKey(LOCALMACHINE,

// "\System\CurrentControlSet\Control\Terminal

// Server\WinStations\RDP-Tcp\");

 

/**

 * 获得 windows server 中的 terminal server 的端口 也就是远程桌面服务的端口

 *

 * @return

 */

public static long getTerminalServerPort() {

long port = -1;

 

if (rdpKey.hasValues()) {

RegistryValue portNumber = rdpKey.getValue("PortNumber");

System.out.println(portNumber.toString()); // Name: PortNumber Type:

// REG_DWORD Value: 3389

String value = portNumber.toString();

port = Long.valueOf(value.substring(value.lastIndexOf(": ") + 2));

System.out.println("port: " + port);

}

 

return port;

}

 

public static void main(String[] args) {

 

SysServiceUtil sysx = new SysServiceUtil();

List li = sysx.getList();

System.out.println(AtiJson.gson(li));

 

}

 

/**

 * attilax 2016年4月12日 下午2:35:10

 *

 * @return

 */

@SuppressWarnings("all")

public List getList() {

// getTerminalServerPort();

String roottype = "1:man,2:auto,3:manType3,4:disable";

Map roottype_m = YamlAtiX.getMap_fromTxt(roottype);

RegistryKey k = new RegistryKey(LOCALMACHINE,

"SYSTEM\\CurrentControlSet\\services");

//todox  drektly use fullpath se ,get retu is empty in get subkey..zihao use jeig locamacie var mode..

// System.out.println( AtiJson.toJson(k));

/*

 *

 * { "hKey": -2147483647, "name": "services", "path":

 * "HKEY_CURRENT_USER\\HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet",

 * "handles": [], "created": false, "level": 4, "lastError": 0,

 * "view64": 256 }

 */

// k.g

List<RegistryKey> li = k.getSubKeys();

// k.getSubKeys(".NETFramework")

// k.getSubKeyNames()

// k.getNumberOfSubKeys()

System.out.println(li.size());

List<Map> li_r = Lists.newLinkedList();

int i = 0;

for (RegistryKey registryKey : li) {

try {

i++;

System.out.println(i);

// System.out.println( AtiJson.toJson(registryKey));

System.out.println(registryKey.getName());

if (registryKey.getName().equals("AcpiPmi"))

System.out.println("dbg");

Map m = Maps.newLinkedHashMap();

if (registryKey.getValue("Description") != null) {

RegistryValue v = registryKey.getValue("Description");

 

byte[] byteData = v.getByteData();

// Object s = strUtil.from_wz_encode( byteData,"gbk");

Object s = strUtil.from_wz_encode(byteData,

"UnicodeLittleUnmarked");

m.put("Description", s);

}

 

m.put("name", registryKey.getName());

if (registryKey.getValue("DisplayName") != null) {

 

RegistryValue v = registryKey.getValue("DisplayName");

// v.getName() ==DisplayName

// v.toString()

byte[] byteData = v.getByteData();

Object s = strUtil.from_wz_encode(byteData,

"UnicodeLittleUnmarked");

 

m.put("DisplayName", s);

 

}

if (registryKey.getValue("ImagePath") != null)

m.put("ImagePath", strUtil.from_wz_encode(registryKey

.getValue("ImagePath").getByteData(),

"UnicodeLittleUnmarked"));

 

m.put("Start", getReg_dword(registryKey.getValue("Start") ));

if(m.get("Start")!=null)

m.put("StartTxt", roottype_m.get(m.get("Start")));

 

// //if DelayedAutostart=1 and auto ,then auto delaye start

 

m.put("DelayedAutostart",getReg_dword(registryKey.getValue("DelayedAutostart") ));

 

li_r.add(m);

catch (Exception e) {

e.printStackTrace();

}

 

//

}

System.out.println("--ok");

 

return li_r;

}

 

/**

attilax    2016年4月12日  下午4:59:53

 * @param string

 * @return

 */

private Object getReg_dword(RegistryValue  regVal) {

if (regVal != null) {

byte[] a=regVal

.getByteData();

return strUtil.from(a[0]);

}

return regVal;

}

 

}

5. 参考

 

批处理操作注册表完全攻略(读取注册表-写入注册表等)_DOS-BAT_脚本之家.htm




原标题:Atitit. 注册表操作查询 修改 api与工具总结 java c# php js python 病毒木马的原理

关键词:C#

C#
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

pc版tiktok:https://www.goluckyvip.com/tag/82270.html
tiktok软路由:https://www.goluckyvip.com/tag/82271.html
tiktok shop 东南亚:https://www.goluckyvip.com/tag/82272.html
download tiktok video:https://www.goluckyvip.com/tag/82273.html
download video tiktok:https://www.goluckyvip.com/tag/82274.html
tiktok长什么样:https://www.goluckyvip.com/tag/82275.html
重庆品胜科技与星苹台达成合作 助力部队现代化后勤建设 :https://www.kjdsnews.com/a/1836523.html
回乡创业,不知道干什么,能否推荐几个农村老家创业的好项目?:https://www.vstour.cn/a/365177.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流