Author Archives: Robins

(20200912Solved) nohup: ignoring input and appending output to ‘nohup.out‘

  • problem description

    using the nohup startup program, the above situation occurs.

    It’s nomarl behavioer. It just informs you that once started the in/output is removed from your console.

    To avoid the message you need to start it like :

    nohup python script.py 2>&1 &
    

    h2李李 <> <>引用

    1. nohup:忽略输入并将输出附加到’ nohup.out ‘

Three ways to get form data in struct2

1. Use ActionContext class

//1获取ActionContext对象
        ActionContext context = ActionContext.getContext();
        //2.调用方法获取key-value值
        Map<String, Object> map = context.getParameters();
        Set<String> set = map.keySet();
        for(String key :set){
            Object[] o = (Object[]) map.get(key);
            System.out.println(Arrays.toString(o));
        }

. Use ServletActionContext

 //使用ServletActionContext对象获取request对象
        HttpServletRequest request = ServletActionContext.getRequest();
        //2.使用request对象获取表单数据
        String username = request.getParameter("username");
        String password = request.getParameter("password");
        String address = request.getParameter("address");
        System.out.println("username="+username);
        System.out.println("password"+password);
        System.out.println("address"+address);

3. Implement ServletRequestAware interface

public class FormDemo3Action extends ActionSupport implements ServletRequestAware {
    HttpServletRequest httpServletRequest;
    @Override
    public void setServletRequest(HttpServletRequest httpServletRequest) {
        this.httpServletRequest=httpServletRequest;
    }
    @Override
    public String execute(){
        String username = httpServletRequest.getParameter("username");
        String password = httpServletRequest.getParameter("password");
        System.out.println("username="+username);
        System.out.println("password="+password);

        return NONE;
    }
}

NVIDIA docker failed to start normally

updated the nv driver to 450 last week, and then found that nvidia-docker could not start, error:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"process_linux.go:432: running prestart hook 1 caused \\\"error running hook: exit status 1, stdout: , stderr: nvidia-container-cli: initialization error: driver error: failed to process request\\\\n\\\"\"": unknown.

USES the command:

$ nvidia-container-cli -k -d /dev/tty info

also gives an error:

-- WARNING, the following logs are for debugging purposes only --

I1001 02:01:39.488895 21811 nvc.c:281] initializing library context (version=1.0.7, build=b71f87c04b8eca8a16bf60995506c35c937347d9)
I1001 02:01:39.488944 21811 nvc.c:255] using root /
I1001 02:01:39.488952 21811 nvc.c:256] using ldcache /etc/ld.so.cache
I1001 02:01:39.488959 21811 nvc.c:257] using unprivileged user 1000:1000
W1001 02:01:39.490269 21812 nvc.c:186] failed to set inheritable capabilities
W1001 02:01:39.490334 21812 nvc.c:187] skipping kernel modules load due to failure
I1001 02:01:39.490648 21813 driver.c:133] starting driver service
E1001 02:01:39.490932 21813 driver.c:197] could not start driver service: load library failed: libcuda.so.1: cannot open shared object file: no such file or directory
I1001 02:01:39.491071 21811 driver.c:233] driver service terminated successfully
nvidia-container-cli: initialization error: driver error: failed to process request

so the corresponding version of cuda1

is upgraded

$ apt install libcuda1-450

and then back to normal

U disk installation Linux system could not boot, / dev / root does not exist and the identified hard disk space is not available

UltraISO made U disk start disk

first use centos7, not successful, changed centos8 or not successful, then start to find the cause of the problem

1. Pay attention to the “easy start – write to new drive boot sector -Syslinux”

before writing

2, could not boot, /dev/root does not exist
because the configuration path in the installation boot is wrong,

solution 1,
in the option to install the page, press TAB, “hd:LABEL= XXXXX” in the XXXXX into their own usb disk name

solution two,
in emergency mode, CD /dev into the directory, ls to see all, the hard disk name is generally sda, SDB, SDC so, my computer has two hard disks, u disk should be SDC, then SDC, sdc4, restart back to the installation page to “hd:LABEL= XXXXX” to hd:/dev/sdc4 is ok, if not successful, just try a few sd

3 to enter after installation, hard disk space is not available,
1 t my hard drive, display 1000 k is available, the other is unavailable, this is because the computer before you install a Windows system, hard disk has been allocated a
select the hard disk, check the automatic partition,
and check the order I like to make additional space available click done
the pop-up dialog box select delete all can recycling all space

Cisco ASA prompt modifies the display name hostname priority state context

CN-BJ-WAN-FW01-ASA/pri/act#

ASA#Conf t
ASA(config)# prompt hostname priority state 
CN-BJ-WAN-FW01-ASA/pri/act(config)#

也显示上下文

CN-BJ-WAN-FW01-ASA#conf terminal
CN-BJ-WAN-FW01-ASA(config)# prompt hostname priority state context
CN-BJ-WAN-FW01-ASA/pri/act(config)#
CN-BJ-WAN-FW01-ASA/pri/act(config)# changeto context BJ- PRDO
CN-BJ-WAN-FW01-ASA/pri/act/BJ-PRODO(config)#

Maven download and configuration

maven download and configure

  1. website https://maven.apache.org/

  2. click on the download

  3. in the Previous Choose archives of the Releases

  4. choose to download the version of the

    into to the directory selected binaries, click the apache maven – 3.6.1 track – bin. To download and unzip the zip


    1. environment variable configuration of

      add a new variable

      in the path configuration MAVEN_HOME % % \ bin

      maven – input in the CMD version to see success

    2. modify the configuration file

      modify the apache maven – 3.6.1 \ conf \ Settings XML

      • specifies your warehouse location

        <localRepository>D:\Java\apache-maven-3.6.1\repository</localRepository>
        
      • configuration mirror

        <mirrors>
            <!-- 阿里云仓库 -->
            <mirror>
                <id>alimaven</id>
                <name>aliyun maven</name>
                <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
                <mirrorOf>central</mirrorOf>
            </mirror>
        </mirrors>
        

      • the idea of maven associated Settings

        choose from the menu file – Settings

Extracting the first X lines of a file with Linux

Linux head instruction usage

head-n x file path > The new file name
is here, x stands for the previous x data that you want to intercept, modify
according to needs. For example, if you want to extract 10,000 pieces of data, the instruction is head-n 10000 file path > The new file name
file path is because you need to tell the system where the file is
. If you don’t know, you can use the find /* -name file name to query the location of the file
. The new file generated by> is placed in the same path as the file by default.

Simple use of namedparameterjdbctemplate of spring

Spring JDBC package provides a JdbcTemplate and its two brothers SimpleJdbcTemplate and NamedParameterJdbcTemplate.

NamedParameterJdbcTemplate class is based on the JdbcTemplate class, and it is encapsulated to support named parameter feature.

NamedParameterJdbcTemplate mainly provides the following three methods: the execute method, method of query and queryForXXX, update and batchUpdate method.

Example in the

project:

String username = “root”;
String password = “root”;
String driver = “com.mysql.jdbc.driver”;
String url = “JDBC: mysql:// 127.0.0.1:3306/upwis_flow?CharacterEncoding = utf-8 “;

	Class.forName(driver);
	Connection conn= DriverManager.getConnection(url, username, password);

	DataSource dataSource=new SingleConnectionDataSource(conn,false);
	NamedParameterJdbcTemplate jdbc=new NamedParameterJdbcTemplate(dataSource);
	jdbc.getJdbcTemplate();
	List list = jdbc.queryForList("select * from fw_dir",new HashMap<>());
	System.out.println(list);

Error from server (alreadyexists) clusterrolebindings.rbac.authorization .k8s.io “kubelet

problem description

create bootstrap role to give permission to connect apiserver request signature error, modified as follows:

[root@localhost kubeconfig]# kubectl create clusterrolebinding kubelet-bootstrap –clusterrole=system:node-bootstrapper –user=kubelet-bootstrap
Error from server (AlreadyExists): Clusterrolebindings, rbac authorization. K8s. IO “kubelet – the bootstrap” already exists

problem analysis

this is because an incorrect signature has been created previously, the signature is occupied, and the occupied signature

needs to be deleted

problem solved

1. Delete signature

kubectl delete clusterrolebindings kubelet-bootstrap

2, recreate successfully

[root@localhost kubeconfig]# kubectl create clusterrolebinding kubelet-bootstrap –clusterrole=system:node-bootstrapper –user=kubelet-bootstrap
clusterrolebinding.rbac.authorization.k8s.io/kubelet-bootstrap created

Ida batch processes virus share samples to obtain ASM files and bytes files

recently needed asm file and bytes file samples for analysis, see the see snow forum can have IDA batch mode! It smells so good!

without further ado code

import sys
import os
import subprocess

global idcScriptFileName
global ida32tFilePath
global ida64tFilePath
#global ida32wFilePath
#global ida64wFilePath

# File these feilds with ur own ida file path and the idc file u want to execute!

idcScriptFileName = "batchmod.idc"
ida32tFilePath ='"D:\IDA 7.0\idat.exe"'
ida64tFilePath = "D:\IDA 7.0\idat64.exe"


#the binary file list text
TargetList = "D:\\batch_disassemble\\target_file_list.txt"
TargetFile_object = open(TargetList,"r").readlines()
for eachline in TargetFile_object:
    eachline = eachline.replace('\n','').replace('\r','')
    print(eachline)
    if os.path.exists(eachline):
        tmpExecStr = ida32tFilePath +" -A -c -S" + idcScriptFileName + " " + eachline
        os.system(tmpExecStr) #single process with cmdwindow
print ("All Process have been started!")

Note:

so if you’re using IDA, let’s look at what’s in your IDA directory. Exe, some of them are idaw on the web, for example, I only have idat.exe.

The idc files used in the

code are as follows (I put them in the same directory)

//by obaby
#include <idc.idc>

static main()
{
	// turn on coagulation of data in the final pass of analysis
	SetShortPrm(INF_AF2, GetShortPrm(INF_AF2) | AF2_DODATA);
	Message("Waiting for the end of the auto analysis...\n");
	Wait();
	Message("\n\n------ Creating the output file.... --------\n");
	auto path = GetIdbPath()[0:-3] + "asm";  //change the data to the length of the file path 
	auto byteFilePath = GetIdbPath()[0:-3] + "bytes";//change the data to the length of the file path 
	auto file = fopen(path,"w");
	auto byteFile = fopen(byteFilePath,"w");
	GenerateFile(OFILE_LST,file,0,-1,0);
	auto addr = MinEA();
	auto i=0;
	for( addr; addr != BADADDR; addr = NextAddr(addr) ){
    		fprintf(byteFile,"%02X",IdbByte(addr));
    		if (i == 15){
        		fprintf(byteFile,"\n");
        		i=0;
    		} else {
        		fprintf(byteFile," ");
        		i++;
    		}
	}
	fclose(file);
	fclose(byteFile);
	Message("All done, exiting...\n");
	Exit(0); // exit to OS, error code 0 - success
}

The file name in the

code is the path to my file that I got myself, as follows:

import os
file_path='D:\\traindata_1\\bancos'
file_list=[i for i in os.listdir(file_path)]
fw=open('target_file_list.txt','a')
for file in file_list:
    fw.write('%s\\%s\n'%(file_path,file))
fw.close()


Common errors and modification methods of findbug

  1. findbugs:EI_EXPOSE_REP
    problem description: Getters and setters of the may expose internal representation by returning reference type
    eclipse automatically generates reference type (Object, array, Date, etc.) will get or expose the inner implementation of the code by referring to the mutable Object. There are many solutions provided that the returned or assigned Object is not the original reference Object.
# Date
public Date getHappenTime() {
if(happenTime != null){
return (Date) happenTime.clone();
}
    return null;
}
# 数组
public String[] getStringArrary() {
if(stringArray != null){
return Arrays.copyOf(stringArray, stringArray.length);
}
    return null;
}
# hashTable
table = new HashTable(hashTable);
  1. findbugs: EI_EXPOSE_REP2
    description: May expose internal representation by storing the an externally mutable object into a setter method returns a reference type
    eclipse to automatically generate a reference type (object, array, the Date, etc.) or through the getter and setter methods get the variable object reference operation and internal implementation code, open the solution a lot, As long as the returned or assigned object is not the original reference object.
    solution:
# Date类型为例:
public void setHappenTime(Date happenTime) {
if(happenTime != null){
this.happenTime = (Date) happenTime.clone();
}else{
this.happenTime = null;
}
}
# 数组
public String[] setStringArrary(String[] arr) {
if(arr != null){
this.stringArrays = Arrays.copyOf(stringArray, stringArray.length);
} else {
 this.stringArrays =null;
}
}

3.CN_IDIOM_NO_SUPER_CALL

clone method does not call super.clone()
a non-final class defined the clone() method without calling the super.clone() method. For example: B extends from A and if the clone method in B calls spuer.clone() and the clone in A does not call spuer.clone(), that results in an inaccurate result type. Spuer. clone() is called from A’s clone method.

  1. findbugs:DC_DOUBLECHECK

multi-threading – Possible double check of field
multi-threading double check of field
, solution, add volatile keyword decoration to the field.

  1. [NP_NULL_PARAM_DEREF]
    description: Null passed for nonnull parameter passed to nonnull parameter
    solution: add nonnull judgment