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. C# 中的.pdb/ .vshost.exe/ .vshost.exe.manifest文件

    转自 C# 中的.pdb/ .vshost.exe/ .vshost.exe.manifest文件讨论 pdb文件: 英文全称:Program Database File 中文全称:程序数据库 文件 ...

  2. iOS: 设置App的国际化和本地化

    原文链接:http://www.cocoachina.com/appstore/20160310/15632.html 前言 App的名字设置方式有很多种,如果在App打包上线时不做修改,最终App的 ...

  3. 【Todo】phantomjs获取动态网页

    上面一篇文章,使用了cheerio, http, request等库,来抓取了Lofter上面的美女图片. 但是很多网页是动态渲染的.据了解,Phantom.js 可以获取动态渲染的网页 http:/ ...

  4. Django开发流程及实例

    创建虚拟环境 创建:mkvirtualenv [虚拟环境名称] 删除:rmvirtualenv [虚拟环境名称] 进入:workon [虚拟环境名称] 退出:deactivate 所有的虚拟环境,都位 ...

  5. vue项目配置使用flow类型检查

    你是否经常在debug那些简单可避免的bug?可能你给函数传参的时候搞错了参数的顺序,或者本来应该传个Number类型的参数,你传了一个String类型?JavaScript的弱类型是这一类bug的罪 ...

  6. mysql5.7用户密码策略问题

    密码策略问题 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements 查看 mysql 初 ...

  7. 如何使用 awk 输出文本中的字段和列

    首先我们要知道,awk 能够自动将输入的行,分隔为若干字段.每一个字段就是一组字符,它们和其他的字段由一个内部字段分隔符分隔开来. 如果你熟悉 Unix/Linux 或者懂得 bash shell 编 ...

  8. android不同机型上界面适配问题

    android中长度有:dp(或者dip device independent pixels)一种基于屏幕密度的抽象单位.在每英寸160点的显示器上.1dp=1px. 不同设备有不同的显示效果.这个和 ...

  9. 【原创】Android自定义适配器的使用方法

    比如说我们已经得到了数据,想在一个listview或者在其他的控件中显示的,并且我们显示想要自己设计样式来显示的话就要用到自定义适配器了,下面让我们结合代码讲一下具体的使用方法: 代码会有注释的哦: ...

  10. Win7是否可以把光盘当作U盘用

    光盘当作U盘用 在Windows 7刻录功能中,之前有看到一篇文章<Windows7 新功能 光盘当U盘用>(感兴趣的同学可以百度一下),文章的意思大致是说作者插入了一张空的DVD光盘,然 ...