336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.


리눅스 또는 윈도우 iso 이미지 파일로부터 부팅 가능한 USB메모리를 만드는 방법이다. 터미널창에서 명령어로 쉽게 가능하다(데비안/우분투 기준).

우선 USB메모리를 연결한 후, 장치명을 확인하자. 터미널창에서 아래와 같이 입력.

# 장치 목록 표시
lsblk

출력된 결과로부터 USB메모리에 대응하는 장치명을 파악한다. 통상 /dev/sdc, /dev/sdd 이런식이 될 것이다. 여기서는 장치명이 /dev/sdc라고 가정해 보자.

만약 해당 USB메모리가 마운트 되어 있다면 해제해야 한다. 디스크 빈 공간을 확인하기 위한 df 명령으로 간단히 확인 가능하다. 만약 마운트되어 있다면 장치명과 마운트된 디렉토리가 표시될 것이다.

# 디스크 빈 공간 확인
df

# /dev/sdc 마운트 해제
sudo umount /dev/sdc

이제 dd 명령을 이용해서 iso 이미지 파일을 옮기면 된다. 예를 들어 ubuntu.iso 파일을 /dev/sdc로 옮긴다면 아래와 같이 입력.

# ubuntu.iso 파일을 /dev/sdc 장치로 보냄
sudo dd if=ubuntu.iso of=/dev/sdc bs=4M && sync

dd 의 옵션을 보자면, if는 입력대상(읽어야 할 파일, iso 이미지), of는 출력대상(USB메모리), bs는 한번에 읽어서 처리할 용량 단위인데 iso의 블록 단위인 2048바이트의 배수로 적당히 정하면 될 듯(위의 예시에서는 4MB)

dd 명령이 종료된 후에도 USB메모리에 쓰는 작업은 아직 끝나지 않았을 수가 있다. 따라서 dd 명령이 정상적으로 종료되고 나면 sync 명령으로 메모리와 디스크를 동기화해 주면 완료.








Posted by af334
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

[Desktop Entry]

Name=Eclipse 4

Type=Application

Exec=/opt/eclipse/eclipse

Terminal=false

Icon=/opt/eclipse/icon.xpm

Comment=Integrated Development Environment

NoDisplay=false

Categories=Development;IDE;

Name[en]=Eclipse



eclipse.desktop 파일 형태로 desktop 폴더에 저장후 권한 조정 후 사용 가능





xdg-open 참고

'Linux' 카테고리의 다른 글

.vimrc 설정  (0) 2015.08.10
linux compression / decompression  (0) 2015.07.06
vim hex mode  (0) 2015.06.15
memory setting using malloc() and practicing coding  (0) 2014.08.29
iptables and setting ftp server  (0) 2014.08.22
Posted by af334
2015. 8. 10. 00:58
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

vimrc




  1 set tabstop=2
  2 set shiftwidth=2
  3 set expandtab
  4 set softtabstop=2
  5 set visualbell
  6 set cindent
  7 set autoindent
  8 set smartindent
  9 set enc=utf8
 10 set incsearch
 11 syntax on
 12 filetype on
 13 set background=dark
 14 colorscheme evening
 15 set backspace=eol,start,indent
 16 set history=1000
 17 set hlsearch
 18 set ignorecase
 19 set showmatch
 20 set number
~                

'Linux' 카테고리의 다른 글

Creating desktop Icon in debian linux  (0) 2016.09.27
linux compression / decompression  (0) 2015.07.06
vim hex mode  (0) 2015.06.15
memory setting using malloc() and practicing coding  (0) 2014.08.29
iptables and setting ftp server  (0) 2014.08.22
Posted by af334
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.


.zip

압축

$ zip -r [압축파일명.zip] [압축할 파일/디렉토리]


압축 해제

$ unzip [압축파일명.zip]


.tar

압축

$ tar cf [압축파일명.tar] [압축할 파일/디렉토리]


압축 해제

$ tar xf [압축파일명.tar]


tar.gz

압축

$ tar zcf [압축파일명.tar.gz] [압축할 파일/디렉토리]


압축 해제

$ tar xfz [압축파일명.tar.gz]


.tar.bz2

압축

$ tar jcf [압축파일명.tar.bz2] [압축할 파일/디렉토리]


압축 해제

$ tar xfj [압축파일명.tar.bz2]


.tar.xz - 이중으로 압축을 풀어야 합니다.

압축 해제 (.xz 압축 해제 -> tar 압축 해제)

$ xz -d [압축파일명.tar.xz]

$ tar -xf [압축파일명.tar]

'Linux' 카테고리의 다른 글

Creating desktop Icon in debian linux  (0) 2016.09.27
.vimrc 설정  (0) 2015.08.10
vim hex mode  (0) 2015.06.15
memory setting using malloc() and practicing coding  (0) 2014.08.29
iptables and setting ftp server  (0) 2014.08.22
Posted by af334
2015. 6. 15. 01:41
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.




바이너리로 저장된 파일을 hex코드로 보는 명령이 기본적으로 vim에도 있습니다.


:%!xxd




돌아가는 것은


:%!xxd -r

'Linux' 카테고리의 다른 글

.vimrc 설정  (0) 2015.08.10
linux compression / decompression  (0) 2015.07.06
memory setting using malloc() and practicing coding  (0) 2014.08.29
iptables and setting ftp server  (0) 2014.08.22
firewall and regulations for control net condition  (0) 2014.08.21
Posted by af334
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Q. 



#include <stdio.h>


int main(){

char str[20]={0};

char *ptr=str;


printf("input str : ");

//scanf("%s", str);

gets(str);

while(*ptr){

if(*ptr>='a' && *ptr<='z'){

*ptr=*ptr-32;

}else if(*ptr >= 'A'&& *ptr <='Z'){

*ptr=*ptr+32;

}


ptr++;

}


printf("str :%s \n", str);


return 0;

}

------------------


Q.


#include <stdio.h>
#include <string.h>

int main(){

char str[20]={0};
char *ptr =str;
int i=0;
while(1){
printf("input str : ");
gets(str);
//if(str=="END"){ //주소기 때문에 바로 비교 불가 -> strcmp (str, "END"); -> 0
if(!strcmp(str, "END")){    
break;
}

i = strlen(str)-1;

for(i=19;i>=0; i--){
printf("%c", *(ptr+i));
}
puts("");
}
return 0;
}


-----------------------

- 메모리 동적 할당  
   -> heap에 저장 됨

원하는 만큼 공간 할당

stack 
data
heap


void* malloc(size_t size);

typedef unsigned int size_t   -> unsigned (양의 정수 )


동적 할당
void*   -> 할당된 공간의 시작주소를 리턴함 
    -> 사용할 때는 반드시 캐스팅을 해야함 
    -> 정해지지 않은 크기를 받아야 할때 
    -> 메모리 관리 효율적 -> 메모리 공간 낭비 방지 
-> 메모리 공간을 다 사용 했을 땐, 할당된 공간을 해제해야 함  -> free()


----------

#include <malloc.h>
#include <stdlib.h>

둘다 malloc 함수 있음, 선택해서 씀



-------------

main(){

int * ptmp =malloc(100);
int * ptmp2=(int*)malloc(100);   (int)로 캐스팅하면 에러 -> int 형태의 주소로 캐스팅 해야함 

free(ptmp);
}


-------------------

- 제한된 heap 공간 
   -> free()

연속으로 free()하면 다른게 해제됨


---------


main(){

int i=0;
int * ptmp=(int*)malloc(sizeof(int)*3);    // sizeof를 이용해 정확한 크기로 공간 할당 
char *pch=(char*) malloc(20);        // 사용자가 알아서 용도를 정하기 

ptmp[0]=10;
ptmp[1]=20;   //포인터를 배열처럼 쓰기 
ptmp[2]=30;

printf("Sum : %d\n", ptmp[0]+ptmp[1]+ptmp[2]);

for(i;i<10;i++){
pch[i]=0x61+i;
}

    pch[i]='\0';    //i= 10     //0   '\0'    NULL

printf("%s\n",pch);

free(ptmp);
free(pch);

}




-----------


- 메인 함수로 인자 전달

   메인함수로 들어가기 전에 전달 -> ex) ls -al   : al이라는 인자 전달하면서 프로그램 실행 

main(int argc, char *argv[])


int argc : 인자의 개수  -> 실행 파일이름도 인자로 여겨서 세어줘야 함
 ls -al  : 인자 3개 

char * argv[] :  전달했던 인자값들이 배열형태로 들어감  -> 문자열 형태 


test.exe -> [0]
인자1  -> [1]
인자2  -> [2]

-------------------


main(int argc, char * argv[]){

int i=0;
printf("전달된 문자열의 수 : %d \n", argc);

for(i=0;i<argc;i++){
printf("%d번째 문자열 : %s \n", i+1, argv[i]);
}
}


------------

비주얼에서 alt +F7  -> Debug  -> Program arguments 에서 인자 입력 가능


-----



%.2f

--------

Coding Practicing 








'Linux' 카테고리의 다른 글

linux compression / decompression  (0) 2015.07.06
vim hex mode  (0) 2015.06.15
iptables and setting ftp server  (0) 2014.08.22
firewall and regulations for control net condition  (0) 2014.08.21
obtaining root position using telnet service system  (0) 2014.08.21
Posted by af334
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

service httpd start


/etc/sysconfig/iptables 80 open


웹서버는 처음엔 전부 닫혀있는 상태

iptables 에서 ACCEPT를 먼저 올리고 DROP을 밑으로 (white list기반




---------------


ftp 서버 설치 

방화벽 21 열기 

service iptables restart


yum install -y vsftpd


/etc/vsftpd/vsftpd.conf 에서 설정


service vsftpd restart


계정 생성

useradd -d /var/ftp/ aaa




 - trouble shooting 

vsftpd 사용시 간혹 디렉토리 목록들이 보이지 않는 경우가 발생합니다.

이 경우 passive mode로 인한 문제로 서버내 설정파일에서 disable 해주면 문제가 해결 됩니다.


vi /etc/vsftpd/vsftpd.conf

pasv_enable=NO

vsftpd 재시작

/etc/init.d/vsftpd restart




Posted by af334
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

xinetd를 이용한 root권한 획득후


-> 입력 리다이렉션을 이용한

-> 패스워드 초기화

-> 




--------------



- 방화벽(Firewall)




화이트 리스트 기반 - 명단에 있는 것만 허용

                           - 우선으로 모두 차단(all)후 등록된 것만 허용



블랙 리스트 기반 - 명단에 있는 것만 차단

      - 차단만 등록





- 들어오는건 주로 차단 하지만 나가는건 잘 차단 안 함




---------------


- iptables Command


-A : append a Rule(--append)




ACCEPT

DROP

DENY -  허용하지 않는 메시지를 보냄 // 잘안 씀



-A INPUT -s 192.168.0.11 -p icmp -j ACCEPT

               (출발지)


-A INPUT -p tcp -dport 7070 -j DROP

(도착지port)


-A OUTPUT -p udp -sport 6060 -j DROP

    (출발지port)



---------------


TCP rapper


hosts.deny

in.telnetd:192.168.0.10

sshd:192.168.0.201



hosts.allow



----------


telnet root 접속 허용


/etc/securetty에

pts/0~9 까지 추가




----------------



last


/var/log/secure







Posted by af334
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.


link와 xinetd를 이용한 root 권한 획득


/etc/xinetd.d/telnet  -> /home/user/.bash_history로 링크된 /tmp/user 파일 실행  -> 

/etc/services

/etc/sysconfig/iptables



link -> /home/user/.bash_history


telnet원격 접속 -> /home/user/.bash_history 실행  -> vi -> chmod 777 /etc/passwd, 

       chmod 777 /etc/shadow

vi /etc/passwd  -> root 비번 조작 







Posted by af334
2014. 8. 18. 16:31
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Inode  - 파일을 찾아가는 주소 


inode를 끊는것 -> 파일을 지운다 

    -> 하드디스크에는 실질적으론 지우는 기능은 없음, 덮어씀




hard link - inode 번호를 공유 (copy와 유사하지만 전혀 다른 개념)

 - 내용수정, 권한 변경 하면 원본도 내용,권한 바뀜


symbolic link - 윈도우의 '바로가기' 와 같음 (파일 이름 기본) -> 파일 이름 바뀌면 못찾아감 

 * 리눅스에서는 디렉토리도 파일로 인식함

 - 원본 파일 이름(포인터)

 - 내용수정, 권한 변경 하면 원본도 내용,권한 바뀜 -> 


-> 차이는 파일 이름으로 찾아간다는 것

 


----------


link를 이용해 지웠던 파일 되살리기(inode 되찾아 주기)



-----------




리눅스 설치


RPM


설치: rpm -Uvh 파일명   //잘 안씀


설치 확인 : rpm -qa 패키지 이름







- 의존성 


코덱 > C++ > lib






-------




yum check-update  - 특정 패키지 업데이트 확인

yum check-update ssh

yum update

yum remove

yum list sftp




yum 설정 파일

/etc/yum.conf

/etc/yum.repos.d/



------------


daemon 



standalone - 24시간 혼자서 구동중

xinetd - 요청하면 구동, 요청을 받음


*d 가 붙으면 daemon



httpd

telnetd

snmpd

sshd

dhcpd




yum install telnet-server

-> xinetd 먼저 설치됨



설정 파일 폴더 : /etc/xinetd.d/telnet  

포트 확인

/etc/service 확인 



service xinetd start /restart /stop


방화벽 설정


/etc/sysconfig/iptables


누군가가 지웠거나, 방화벽 비활성화 되었을땐 iptables 내용 무


dport (destination port)

-A  (룰을 추가하겠다)

input (server로 들어오는 것)

output (server에서 나가는것)



*허용/차단의 코드 순서를 따져야함 



service iptables restart


yum install telnet  // client 설치


telnet은 root로 직접 로긴 불가 




pstree로 xinetd밑으로 프로세스가 있는것을 확인 






Posted by af334
이전버튼 1 2 3 이전버튼