.8 Process (01)

OllyDbg逆向实战案例:绕过登录验证流程 用OllyDbg动态分析程序,定位关键验证逻辑,修改跳转指令实现登录绕过。整个过程紧扣OllyDbg的断点设置、寄存器观察与汇编 patch 技巧,是逆向工程中典型的实战入门路径。 阅读详情

process control provided by the UNIX System


1.PID

pid:0 ---> scheduler process          (system kerenel proc)

pid:1 ---> init process            (normal user proc)  /etc/rc* , /etc/inittab ,  /etc/init.d/  


E.g:

int main(int argc, char *argv[])
{
        pid_t t1,t2;
        uid_t t3,t4;
        gid_t t5,t6;

        t1=getpid();
        t2=getppid();

        t3=getuid();
        t4=geteuid();

        t5=getgid();
        t6=getegid();

        printf("--------------- test pid --------------------\n");
        printf("pid: %d\n",t1);
        printf("ppid: %d\n",t2);

        printf("uid: %d\n",t3);
        printf("euid: %d\n",t4);

        printf("gid: %d\n",t5);
        printf("egid: %d\n",t6);

        return 0;

}


Find the user's uid gid and other uid member

E.g:

int main(int argc, char *argv[])
{
        char    _name[256];
        struct group    *pGr=NULL;
        int     _count=0;
        char    *_mem = NULL;

        printf("******* Just Only Finding *******\n");

        printf("input the name you want to search:");
        scanf("%s",_name);


        // -------------- find from input Name -------------
        struct passwd   *ptr=NULL;
        setpwent();
        while( (ptr = getpwent())!=NULL)
        {
                if(strcmp(_name,ptr->pw_name)==0)
                        break;
        }

        endpwent();

        // -------------- output pw_xxx Uid Info ------------
        if(ptr)
        {
                printf("uid=%d\n",ptr->pw_uid);
                printf("gid=%d\n",ptr->pw_gid);
                printf("dir=%s\n",ptr->pw_dir);
                printf("pwd=%s\n",ptr->pw_passwd);
                printf("cmd=%s\n",ptr->pw_shell);
        }
        else
        {
                printf("there's no ID called %s\n",_name);
                exit(0);
        }

        // -------------- group check -----------------------
        printf("-------------- GID: %d ------------\n",ptr->pw_gid);

        setgrent();

        while( (pGr = getgrent())!=NULL)
        {
                if(pGr->gr_gid==ptr->pw_gid)
                        break;
        }
        endgrent();

        if(pGr)
        {
                for(_count=0; _count < 1000; _count++)
                {
                        if(pGr->gr_mem[_count]!=NULL)
                        {
                                _mem = pGr->gr_mem[_count];

                                printf("%04d [%s]: %s \n",_count,pGr->gr_name,_mem);
                        }
                        else
                        {
                                break;
                        }
                }
        }
        exit(0);
}



2. Fork()  called once but returns twice


The reason the child's process ID is returned to the parent is that a process can have more than one child, and there is no function that allows a process to obtain the process IDs of its children.

we never know whether the child starts executing before the parent or vice versa.

int     glob = 6;       /* external variable in initialized data */
char    buf[] = "a write to stdout\n";

int
main(void)
{
    int       var;      /* automatic variable on the stack */
    pid_t     pid;

    var = 88;
    if (write(STDOUT_FILENO, buf, sizeof(buf)-1) != sizeof(buf)-1)
        err_sys("write error");
    printf("before fork\n");    /* we don't flush stdout */

    if ((pid = fork()) < 0) {
        err_sys("fork error");
    } else if (pid == 0) {      /* child */
        glob++;                 /* modify variables */
        var++;
    } else {
        sleep(2);               /* parent */
    }

    printf("pid = %d, glob = %d, var = %d\n", getpid(), glob, var);
    exit(0);
}


* race conditions

synchronize a parent and a child : 

we simply have the parent put itself to sleep for 2 seconds, to let the child execute


* strlen() PK sizeof()  aboutstring

strlen() ---> in execute tiem  function call

sizeof() --->value in compile time operator

                    (above case: the buffer is initialized with a known string, and its size is fixed)


* stand output buffer

$ ./a.out
a write to stdout
before fork
pid = 430, glob = 7, var = 89      child's variables were changed
pid = 429, glob = 6, var = 88      parent's copy was not changed
$ ./a.out > temp.out
$ cat temp.out
a write to stdout
before fork
pid = 432, glob = 7, var = 89
before fork
pid = 431, glob = 6, var = 88

Indeed, one characteristic offork is that all file descriptors that are open in the parent are duplicated in the child.

* why the fork() fail --- two reasons:

 (a) if too many processes are already in the system, which usually means that something else is wrong

 (b) if the total number of processes for this real user ID exceeds the system's limit. 

       that CHILD_MAX specifies the maximum number of simultaneous processes per real user ID.



3. File sharing in Parent & Child by Fork()

It is important that the parent and the child share the same file offset.

fork() --------- exec()    

two separate functions in UNIX

separating the two allows the child to change the per-process attributes between the fork and the exec


vfork()

1) provides an efficiency gain on some paged virtual-memory implementations of the UNIX System.

2) guarantees that the child runs first, until the child callsexec orexit. 

    When the child calls either of these functions, the parent resumes.


4. Eixt  functions()

    1)  eixt() --- ISO  C    -------------- a)  calling the  atexit();   b) close all the std IO streams     std library call

    2)  _Exit() --- ISO  C  -------------- without singal() ,without atexit() 

    3)  _exit() --- POSIX.1  --------------- kernel system call 

    4)  returnfrom the start routine of the last thread in the process.   --->  process exit code = 0 

    5)  Calling thepthread_exit function from the last thread in the process.  --->  process exit code = 0

     | 

1~3 )  ---------> parsing the exit status code to Parent Process.

4~5 )  ---------> kernel generates a status code for abnormal reason 

     |

Parent process :  either thewaitor thewaitpidfunction  -----------------   return code ; 


* If parent process dead before the child ,  Init process  as  parent .



5. wait & waitPid 

#include <sys/wait.h>

pid_t wait(int *statloc);

pid_t waitpid(pid_t pid, int *statloc, int options);

Process terminate ----------> SIGCHLD signal ----------->  Parent Process : 


a) ignore this signal 

b) signal handler ( ) 


Return :

  • Block, if all of its children are still running

  • Return immediately with the termination status of a child, if a child has terminated and is waiting for its termination status to be fetched

  • Return immediately with an error, if it doesn't have any child processes


More than one children proc Case:

wait()  --- >  returns on termination of any of the children

waitpid() --- >  

The interpretation of the pid argument for waitpid depends on its value:

pid == 1
 Waits for any child process. In this respect, waitpid is equivalent to wait.
 
pid > 0
 Waits for the child whose process ID equals pid.
 
pid == 0
 Waits for any child whose process group ID equals that of the calling process. (We discuss process groups in Section 9.4.)
 
pid < 1
 Waits for any child whose process group ID equals the absolute value of pid.
 


Error :

wait() ---> has no children | interrupted by a signal 

waitpid() ---> not exist or is not a child of the calling process 



CATIA二次开发避坑指南:C#与VBA接口调用常见报错解决方案大全 本文针对CATIA二次开发中C#与VBA接口调用的常见难题,提供了一套系统性的解决方案。重点解析了COM互操作中的对象生命周期、引用计数陷阱以及高频错误码(如HRESULT: 0x80004005),并分享了高级调试技巧与稳定性优化策略,旨在帮助开发者有效规避开发陷阱,提升开发效率与代码健壮性。 阅读详情

相关推荐

测试pyspark时,解决Java gateway process exited的问题

今天测试pyspark时,出现了当上述报错。我是在udemy上课的时候按照课程步骤来安装材料如下图: 就一直卡在pyspark测试那边。 lecturer安装的东西有 (依次 java15(lectuer装的15,我装的最新的JDK16.01)>>Java SE Development Kit 16 - Downloads (oracle.com) hadoop2.71:winutils >>GitHub - steveloughran/winutils: Wi..

weixin_51951625的博客 4110

signature=37ce0b9d13e748f4ef00e8b1a66e8b01,Process for the continuous extraction of mixtures of orga...

BACKGROUND OF THE INVENTION1. Field of the InventionThe present invention relates to a method of processing mixtures of organic substances, including high boiling point constituents and/or constituent...

weixin_42676824的博客 363

GEE高阶应用——利用eemont一行代码进行Landsat8/S2数据预处理(process)

Landsat 8是一颗美国国家航空航天局(NASA)和美国地质调查局(USGS)联合发射的卫星,提供了高质量的遥感影像数据,用于监测地球表面的变化和变化。在利用Landsat 8影像数据进行分析之前,需要对数据进行预处理以消除噪音、校正影像、增强图像质量等。以下是Landsat 8影像数据预处理的主要步骤。1. 数据获取:首先,需要从USGS的数据存档中获取Landsat 8卫星所拍摄的影像数据。这些数据通常以每个波段的单独文件形式提供,并且存在多个波段的影像数据需要一起处理。

此星光明博客 764

[MysSQL8笔记]-Access denied; you need (at least one of) the PROCESS privilege(s) for this opera

出现这个原因是:当前用户没有PROCESS权限。使用root用户给当前用户授予PROCESS权限即可。

攻城狮 2815

华为主题包HWT从入门到排障:下载、导入、修改与兼容性指南

手机主题是很多用户个性化设备的起点,华为手机的主题文件以HWT格式封装,本质上是一种结构特殊的ZIP压缩包,内部包含壁纸、图标、字体和XML配置。了解HWT的目录结构与系统版本兼容性,能帮助用户避开导入失败、秒回默认等常见问题。本文从HWT的基本原理讲起,梳理了安全下载渠道、三种导入方式、应用失败的系统性排查思路,并介绍了解包修改壁纸与字体的方法。无论是普通用户还是进阶玩家,掌握这些技术细节都能更从容地在EMUI与HarmonyOS环境下管理自己的主题资源。

weixin_31155097的博客 364

unity 腾讯地图sdk移动和缩放代码

unity 腾讯地图sdk 实现移动端 缩放 和 移动

。。。。。 1283

MySQL 通过 kill process 解决死锁

MySQL死锁处理与预防指南 摘要:本文介绍了MySQL死锁的基础概念、产生条件和典型表现,重点讲解了通过kill process解决死锁的应急方法。详细步骤包括:1)使用SHOW ENGINE INNODB STATUS或SHOW PROCESSLIST精准定位死锁进程;2)执行KILL命令终止阻塞线程。同时强调了操作风险与注意事项,建议优先kill阻塞方进程并做好日志记录。文章最后指出,根本解决方案在于优化锁使用逻辑:统一锁申请顺序、缩小锁粒度、控制事务大小、设置锁等待超时等预防措施。kill proc

xiaolyuh的专栏 4万+

fsQCA实战:从数据校准到结果解读的完整流程(附R代码示例)

本文提供了一份完整的模糊集定性比较分析(fsQCA)实战指南,详细阐述了从数据校准、必要条件分析、真值表构建到布尔最小化与结果解读的全流程。通过R语言代码示例,帮助研究者掌握如何将理论转化为可操作的分析步骤,并产出稳健的中间解,以揭示导致结果的复杂条件组合。

d6e7f8g9h的博客 1171

使用EPROCESS下Win32Process枚举进程

此方法硬编码很多!!! EPROCESS下win32Process其实是一个tagPROCESSINFO 结构 typedef struct _tagPROCESSINFO // 55 elements, 0x300 bytes (sizeof) {

zhuhuibeishadiao 4220

告别130MB/s瓶颈!用Zynq+NVMe实现1.2GB/s高速存储的PL数据分流实战

本文详细介绍了如何通过Zynq+NVMe实现1.2GB/s高速存储的PL数据分流方案,突破传统Zynq架构130MB/s的瓶颈。文章分享了PL直连NVMe的硬件架构设计、软件栈优化及性能调优实战技巧,帮助开发者实现高速数据流的稳定存储。

weixin_42653691的博客 372

WRF和WPS模型在Ubuntu系统上的安装与常见问题解决指南

本文详细介绍了在Ubuntu系统上安装WRF和WPS模型的完整教程,涵盖系统环境配置、依赖库安装、源代码编译以及常见问题的解决方案。重点解决了WPS编译中intmath.f文件的修改、环境变量设置和编译器兼容性等关键难点,帮助用户高效部署气象研究与预报模型。

weixin_29213525的博客 382

如何用好Ministral-3-3B-Instruct-2512-4bit工具调用:从[TOOL_CALLS]令牌到构建AI Agent的完整指南

Ministral-3-3B-Instruct-2512-4bit 是 Mistral AI 推出的 3B 参数多模态指令模型,已转换为 MLX 格式的 4bit 量化版本,可在本地设备高效运行工具调用(Function Calling)任务。本文带你从安装部署、读懂 `[TOOL_CALLS]` 特殊令牌,到搭建一个完整的 AI Agent 循环,零基础也能快速上手。 ## 一、认识模型:3B

gitblog_00282的博客 1007

MaxScript批量修改材质、贴图名称

MaxScript批量修改材质、贴图名称1 实现效果1.1 修改前材质、贴图名称1.2 修改后2 代码 1 实现效果 1.1 修改前材质、贴图名称 1.2 修改后 2 代码 prefixName = "prefiname" maxFile = "maxfilepath" makeDir "newBitmappath" mapsPath = newbitmappath + "\\" fn formatStr index = ( str = index as string newS

郑德帅 3241

libuv8_process

1. libuv-进程 1. libuv-进程 1.1. 简介 1.2. API 1.3. 创建进程 1.4. 父子进程分离 1.5. 向进程发送信号 1.6. 子进程I/O 1.7. 管道 1.8. 参考文章 1.1. 简介   libuv提供子进程的管理工作,抽象平台的差异性,允许通过stream和pipe进行线程之间的交互   unix建议每个进程只做一件事并且做好。所以一个进程常常使用多个子进程来完成各种任务,类似于shell中使用多个pipe。与线程共享内存类似,含有消息的多进程模型也很

knowledgebao的博客 402

《S32系列芯片——Boot & HSE详解》持续更新中...

专栏总目录,将详细介绍S32系列芯片的Boot功能,最终给出HSE基于IVT的Secure Boot方案!!!

车载系统攻城狮 4386

软件设计师高频考点—套路题

学习交流的总结

秩沅 2539

mysqldump: Error: ‘Access denied; you need (at least one of) the PROCESS privilege(s) for this opera

问题:自己在虚拟机的centos7上备份数据库,执行脚步时报错mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces 但是仍然可以备份 可是这个错误看着不舒服百度了一下 最终找到了答案 在这里记录一下 [root@localhost backup]# sh ./mysql_backup.

c1085269585的博客 3万+

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

windbg-.process切换进程(内核)

.process .process 命令指定要用作进程上下文的进程(Set Process Context) .process显示当前进程的EPROCESS,这里显示当前进程为test.exe [cpp] view plain copy print? kd>.process Implicitprocessisnow...

1137

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

oracle server process,为什么数据库中大量的server process没有对应的session?

转自oracle官方博客https://blogs.oracle.com/database4cn/%e4%b8%ba%e4%bb%80%e4%b9%88%e6%95%b0%e6%8d%ae%e5%ba%93%e4%b8%ad%e5%a4%a7%e9%87%8f%e7%9a%84server-process%e6%b2%a1%e6%9c%89%e5%af%b9%e5%ba%94%e7%9a%84se...

weixin_39640911的博客 535

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

8.1 Firmware Update Process

如果控制器在提交试图激活FW image的FW 提交命令之后并且在该命令完成之前转到D3cold 状态(参考PCI Express Base Specification),则控制器可以在提交FW 提交命令时激活FW image或者由该命令激活的FW image的情况下恢复操作。如果无法成功加载FW,则控制器应恢复到最近激活的FW slot中的FW image或基线只读FW image(如果可用),并将故障指示为带有FW image加载错误的异步事件。

hongfuhaocomon的博客 1173

win10无限蓝屏_win10蓝屏died怎么办_win10无限process died解决方法

2017-06-02 11:25:48如果我们在windows10系统​电脑中遇到蓝屏故障时,一定要先记住蓝屏代码,然后查看dmp蓝屏文件分析蓝屏原因。比如,最近有位使用windows10系统的用户就遇到了:criti...2019-12-16 09:27:36win10系统总是蓝屏显示CRITICAL PROCESS DIED怎么办?最近有win10正式版的用户在使用电脑的时候,就出现了该情况。...

weixin_39855843的博客 4462

如何运用Process模型检验有调节的中介效应?

本文详细解析了如何运用Process模型检验有调节的中介效应,包括概念理解、模型选择、SPSSAU操作步骤及结果解读。重点介绍了中介效应和调节效应的结合分析,以及在不同调节变量水平下中介效应的变化模式,为研究者提供了一套完整的分析框架和实用技巧。

weixin_30628801的博客 560

JavaScript_process01

JavaScript_process01 和html使用css一样,使用js也有两种途径,其一为内嵌js代码,其二是外部引用.js文件。 ****************************************************************** 需要注意的是,带有src属性的<script>元素,即采用外部引用方式,不应该在其<script&...

weixin_30505043的博客 109

windbg-.process切换进程

.process 命令指定要用作进程上下文的进程(Set Process Context) .process显示当前进程的EPROCESS,这里显示当前进程为test.exe [cpp] view plain copy   kd> .process   Implicit process is now 821f5da0   kd> ? @$proc

whatday的专栏 2809

frida学习(process,module,memory) && android开发学习(结构,kotlin)(二)

FRIDA输出打印 console.log() console.warn() console.error() console之hexdump 打印内存中的地址 target参数可以是ArrayBuffer或者NativePointer,而options参数则是自定义输出格式可以填这几个参数offset、lengt、header、ansi var libc = Module.findBaseAddress('libc.so'); console.log(hexdump(libc, { offset: 0,

qq_37439229的博客 2427

azkaban报错azkaban.jobExecutor.utils.process.ProcessFailureException

java.lang.RuntimeException: azkaban.jobExecutor.utils.process.ProcessFailureException at azkaban.jobExecutor.ProcessJob.run(ProcessJob.java:304) at azkaban.execapp.JobRunner.runJob(JobRunner.java:784) at azkaban.execapp.JobRunner.doRun(JobRunner.java:6.

LFQ244117370的博客 2201
上一篇: .7 Process Enviroment
下一篇: .Process Deamon
software-NB
博客等级 码龄16年 1粉丝 15原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值