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 病毒木马的原理的更多相关文章

  1. delphi 注册表操作(读取、添加、删除、修改)完全手册

    DELPHI VS PASCAL(87)  32位Delphi程序中可利用TRegistry对象来存取注册表文件中的信息. 一.创建和释放TRegistry对象 1.创建TRegistry对象.为了操 ...

  2. Delphi的注册表操作

    转帖:Delphi的注册表操作 2009-12-21 11:12:52 分类: Delphi的注册表操作 32位Delphi程序中可利用TRegistry对象来存取注册表文件中的信息.     一.创 ...

  3. CRegKey 注册表操作

    CRegKey 注册表操作 标签: accessnulluserpathbyteie 2011-11-03 13:55 3477人阅读 评论(0) 收藏 举报  分类: win32(7)  1.简介 ...

  4. C#注册表操作类--完整优化版

    using System; using System.Collections.Generic; using System.Text; using Microsoft.Win32; namespace ...

  5. C#注册表操作类(完整版) 整理完整

    /// <summary> /// 注册表基项静态域 /// /// 主要包括: /// 1.Registry.ClassesRoot 对应于HKEY_CLASSES_ROOT主键 /// ...

  6. QSettings配置读写-win注册表操作-ini文件读写

    版权声明:若无来源注明,Techie亮博客文章均为原创. 转载请以链接形式标明本文标题和地址: 本文标题:QSettings配置读写-win注册表操作-ini文件读写     本文地址:http:// ...

  7. C# 我的注册表操作类

    using System; using System.Collections.Generic; using System.Text; using Microsoft.Win32; using Syst ...

  8. 《天书夜读:从汇编语言到windows内核编程》八 文件操作与注册表操作

    1)Windows运用程序的文件与注册表操作进入R0层之后,都有对应的内核函数实现.在windows内核中,无论打开的是文件.注册表或者设备,都需要使用InitializeObjectAttribut ...

  9. 【读书笔记】C#高级编程 第二十四章 文件和注册表操作

    (一)文件和注册表 对于文件系统操作,相关的类几乎都在System.IO名称空间中,而注册表操作由System.Win32名称空间中的类来处理. (二)管理文件系统 System.MarshalByR ...

随机推荐

  1. 【转】记录PHP、MySQL在高并发场景下产生的一次事故

    看了一篇网友日志,感觉工作中值得借鉴,原文如下: 事故描述 在一次项目中,上线了一新功能之后,陆陆续续的有客服向我们反应,有用户的个别道具数量高达42亿,但是当时一直没有到证据表示这是,确实存在,并且 ...

  2. 基于jquery,bootstrap数据验证插件bootstrapValidator

    bootstrap:能够增加兼容性的强大框架. 因为项目需要数据验证,看bootstrapValidator 还不错,就上手一直,完美兼容,话不多说. 需要引用css: bootstrap.min.c ...

  3. javascript 获取http头信息

    Javascript中跟response header有关的就两个方法: getResponseHeader 从响应信息中获取指定的http头 语法 strValue = oXMLHttpReques ...

  4. asp.net membership 修改密码

    aspnet_Applications 存储数据库所涉及应用程序有关信息. aspnet_Membership 存储与用户相关信息例如:用户登陆密码,创建时间. aspnet_Paths 存储应用程序 ...

  5. [转]SQLSERVER存储过程调用不同数据库的数据_存储过程中通过链接服务器访问远程服务器

    本文转自:http://blog.csdn.net/nnaabbcc/article/details/7967761 存储过程调用不同数据库的数据 在存储过程调用不同数据库的数据该如何做,比如在存储过 ...

  6. ArcGIS Server的切图原理深入【转】

    http://blog.newnaw.com/?p=69 GoogleMap,Virtual Earth,YahooMap等,目前所有的WebGIS都使用了缓存机制以提高地图访问速度.原理都是将地图设 ...

  7. JDBC纯驱动方式连接MySQL

    1 新建一个名为MysqlDemo的JavaProject 2 从http://dev.mysql.com/downloads/connector/j/中下载最新的驱动包. 这里有.tar.gz和.z ...

  8. [Algorithom] Shuffle an array

    Shuffling is a common process used with randomizing the order for a deck of cards. The key property ...

  9. 倍福TwinCAT(贝福Beckhoff)常见问题(FAQ)-有时候项目会无法编译,重新生成就自动卡死或者自动退出怎么办

    删除所有中文注释,有中文注释则不一定能编译成功.     更多教学视频和资料下载,欢迎关注以下信息: 我的优酷空间: http://i.youku.com/acetaohai123   我的在线论坛: ...

  10. C/C++中传值和传地址(引用)

    C/C++中参数传递有两种方式,传值或传地址(传引用),通常我们要在被调用函数中改变一个变量的值就需要传地址调用方式,例如: void swap_by_value(int a, int b) { in ...