# Linux/Unix Command and Configuration Summary
## User and Login Commands
1. **View last login for a user:**
```bash
lastlog -u username
View login records from the last 5 days:
link
lastlog -t 5
View reboot records:
last reboot
View failed login attempts for a user:
lastb username
Search for users who executed useradd
:
lastcomm useradd
# Equivalent to:
lastcomm | grep useradd
Strict match search for useradd
command used by root
:
lastcomm --user root --command useradd strict-match
xferlog
details: xferlog - FTP LogEnable process accounting logs:
accton /var/account/pacct
Disable process accounting logs:
accton
missingok
: 로그 파일이 없더라도 에러를 발생시키지 않는다.rotate 6
: 순환할 로그 파일 6개로 설정.dateext
: 확장자는 날짜로 사용.create 0640 root utmp
: 소유자는 root, 소유 그룹은 utmp로 설정.Setuid does not affect realUid
, only Effective UID
and Saved UID
: Details
Buffer Overflow (BOF) Information: BOF Details
Change permissions to remove write access for group and others on .profile
:
chmod go-w .profile
Setuid examples:
chmod 4755 file
chmod u+s file
File permission notations:
-rwsrwxr-x
: s
indicates Setuid.sticky bit
: t
replaces x
in the other
section.Stop sharing a file or directory:
net share 공유네임 /delete
Share a file or directory:
net share 공유네임=file/path
MAC Address Information:
Layer 2 Details:
Datalink Layer Controls:
데이터링크 계층 접근제어 표준:
충돌영역: Collision Domain
브로드캐스트 수신 영역: Broadcast Domain
L2 전송 방식:
Port Mirroring: 패킷을 다른 모니터링 포트로 복제하는 것
Ip 주소 161.134.7.0/24 의 Directed Broadcast 주소: 161.134.7.255
데이터링크 계층 구조:
https://velog.io/@agnusdei1207/llc
PDU (Protocol Data Unit):
VLAN (Virtual Local Area Network):
IP 패킷이 목적지 노드에 도달하기 위해 필요한 것: IP 주소에 대응하는 48bit(6bytes) 의 MAC 주소 -> 앞 3bytes: 제조사, 뒤 3bytes: 제조사에서 부여한 ID
허브 (더미허브):
스위치 (스위칭허브):
MDM (Mobile Device Management):
컨테이너화:
모바일 가상화:
/etc/mail/access.db
: makemap hash /etc/mail/access.db < access.db
세션 ID’ 또는 ‘암호화된 쿠키값’이: 명백하게 ‘랜덤’으로 생성되는지 확인한다.
3. 적절한 ‘암호화 알고리즘’이:** 적용되었는지 확인한다.
NOP: No operation x86 Hexa code : 0x90
redhat: /etc/httpd/conf/httpd.conf
-> LimitRequestBody
https://velog.io/@agnusdei1207/limitRequestBody
Mac flooding = switch jamming:
Tcp dump:
(frag 22444:40:30+)
-> fragmentID, size (bytes), offset+
가 있다면 다음 fragment (단편) 이 아직 남아 있다는 것을 의미MTU 1500 bytes: 일반적으로 설정됩니다. Ip header 20bytes 를 제외한 일반적인 크기는 1480 bytes
케빈 미트닉: ip 를 속이는 공격 -> ip spoofing -> trust 관계가 맺어져 있는 시스템에 굉장히 강력함
Ipv6 128bit 주소 체계, ipv4 32bit 주소 체계
Ipv6 <-> ipv4 전환 기술:
RFC 792: ICMP internet control message protocol
ICMP Redirect:
IGMP internet group management protocol:
TCP flags: TCP flags 참조
Socket:
Well-known port domain: 0~1023
BOOTP: UDP/67 -> 해당 기기가 부팅될 때 ip 주소를 동적으로 받게 해주는 프로토콜
3306/tcp: mariaDB, MySQL
MS-SQL: 1433/tcp
ORACLE: 1521:tcp
가로챈 세션으로 별도의 인증 없이 공격하는 기법: session hijacking -> 세션 하이재킹 (납치)
netBios: TCP/UDP 135, 139 -> windows system 파일 및 폴더 공유 시 사용 -> 초기 컴퓨터간 통신을 위한 프로그래밍 인터페이스
CIFS (SMB) server message block:
Ping: ICMP Echo Request 메세지를 이용하여 이에 대한 응답 ICMP Echo Reply 를 이용하여 RTT (round trip time) 왕복 시간 (경과 시간) 을 알아볼 때 사용
공격자의 침입 경로를 확인하기 위해 현재 통신하고 있는지 알기 위한 명령어:
netstat -artn
: https://velog.io/@agnusdei1207/udp