Sungjin's sub-brain :
Admin : New post
Guestbook
Local
Catergories
Recent Articles
Recent Comments
Calendar
Tag
Archive
Link
Search
 
해당되는 게시물 18건
  Linux, Window에서 mac 어드레스 바꾸기 
작성일시 : 2007. 10. 5. 14:38 | 분류 : 컴퓨터/LINUX

리눅스
ifconfig eth0 down hw ether aa:bb:cc:dd:ee:ff
ifconfig eth0 up

윈도우
아래를 보시오;ㅁ;




Changing Your MAC Address In Window XP/Vista, Linux And Mac OS X
(Sometimes known as MAC spoofing)


First let me explain a few things about MAC addresses. MAC stands for Media Access Control and in a sense the MAC address is a computer뭩 true name on a LAN. An Ethernet MAC address is a six byte number, usually expressed as a twelve digit hexadecimal number (Example: 1AB4C234AB1F).


IPs are translated to MAC address by a protocol called ARP (Address Resolution Protocol). Let뭩 say a computer with and IP of 192.168.1.1 wants to send information to another computer on the LAN that has an IP of 192.168.1.2 . First 192.168.1.1 will send out a broadcast to all stations on the LAN asking who has the IP 192.168.1.2. Then the box that has 192.168.1.2 will respond to 192.168.1.1 with it뭩 MAC address which is cached in 192.168.1.1뭩 ARP table for later use. To put this in Socratic Dialog form (with just a touch of Stallone):


Host 1 (192.168.1.1): Yo everyone on the LAN (FF:FF:FF:FF:FF:FF), who has the IP 192.168.1.2? My MAC is DE:AD:BE:EF:CA:FE so you can respond back to me.

Host 2 (192.168.1.2): Hello DE:AD:BE:EF:CA:FE, I have IP 192.168.1.2 and my MAC address is 12:34:56:78:90:12 so you can send your IP packets to me.


 You can see the ARP table of a box by dropping out to a command prompt and typing 밶rp 뻕?in Windows or just 밶rp?in Linux. ARP can also work the other way by a host on the LAN sending its MAC address to another machine on the LAN for preemptive caching unless the host is configured to not accept un-requested ARP replies.


 A person might want to change the MAC address of a NIC for many reasons:


  1. To get past MAC address filtering on a router. Valid MAC addresses can be found by sniffing them and then the deviant user could assume the MAC of a valid host. Having two hosts on the same network can cause some network stability problems, but much of the time it's workable. This is one of the reasons why MIC Address filtering on a wireless router is pointless. An attacker can just sniff the MAC address out of the air while in monitor mode and set his WiFi NIC to use it. Interestingly, a lot of hotels use MAC filtering in their "pay to surf" schemes, so this method can be an instant in for cheap skate road warriors. 
  2. Sniffing other connections on the network. By assuming another host's MAC as their own they may receive packets not meant for them. However, ARP poisoning is generally a better method than MAC spoofing to accomplish this task.
  3. So as to keep their burned in MAC address out of IDS and security logs, thus keeping deviant behavior from being connected to their hardware. For example, two of the main things a DHCP server logs when it leases an IP to a client is the MAC address and host name. If you have a wireless router look around on it's web interface for where it logs this info. Luckily there are tools to randomize this information (MadMACs).
  4. To pull off a denial of service attack, for instance assuming the MAC of the gateway to a sub net might cause traffic problems. Also, a lot of WiFi routers will lock up if a client tries to connect with the same MAC as the router's BSSID.

Linux

To change your MAC address in Linux (and most *nix system) is easy as pie. All it takes is two easy to script commands:


    ifconfig eth0 down hw ether 00:00:00:00:00:01

    ifconfig eth0 up


These two little commands would set your eth0 interface to use the MAC 00:00:00:00:00:01. Just plug in the NIC you want to set and the MAC address you want to use into the commands above and your done. Changing your MAC address is one of those things that is much easier to do in Linux then under Windows.


Mac OS X


        For versions of OS X before Tiger (OS X 10.4) you will need this patch:


    http://slagheap.net/etherspoof/


Then you use a command like:


    sudo ifconfig en0 lladdr 00:00:00:00:00:01


I'm not much of a Macintosh guy, so I pulled most of this info from:

http://www.macgeekery.com/gspot/2006-04/mac_address_spoofing


My understanding is that there are complications with some AirPort cards so you may also want to read:

http://rgov.org/airport-spoof/


Windows 2000/XP/Vista: The Hard Way

 




            In XP you can use the regedit to edit the registry from a GUI or the reg command to edit it from the console, I뭠l be using regedit. Information on all your NICs can be found the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\  . Under this key you will find a bunch of sub keys labeled as 0000, 00001, 0002 and so forth. We can assume any MAC address we want by finding the key that controls the NIC we want to change, putting in a string value called 밡etworkAddress?and setting it to the MAC address we want to use formatted as a twelve digit hex number (example: 000000000001). To find out which key is which we can search through them for the value 밆riverDesc?until we find the one that matches the NIC we wish to alter. After you set 밡etworkAddress?to the address you want just restart the NIC by disabling it then enabling it (or in the case of PCMCIA cards, just eject and reinsert). You can confirm the MAC address change by using the 밽etmac?or 밿pconfig /all?commands.


Windows 2000/XP/Vista: The Easy Way


            Use Mac Makeup ( http://www.gorlani.com/publicprj/macmakeup/macmakeup.asp ), MadMACs (http://www.irongeek.com/i.php?page=security/madmacs-mac-spoofer), Smac ( http://www.klcconsulting.net/smac/ ) or Etherchange (http://ntsecurity.nu/toolbox/etherchange/ ). Mac Makeup is a cool little GUI and Command line tool that's freeware, the creator also offers a Plugin for Bart's PE builder. MadMACs is a tool to randomize your MAC address and host name on every reboot. Smac has a nice GUI and was free but has since gone commercial, there's no reason to bother with it as there are free tools that are just as good. I use MadMACs since I wrote it and it lets me keep my host information randomized.


        Have fun with your MAC addresses switching, but be careful not to cause network problems. My favorite MAC address is DEADBEEFCAFE, for other interesting MACs see:


http://www.binrev.com/forums/index.php?showtopic=15942


Enjoy.

출처
http://www.irongeek.com/i.php?page=security/changemac

|
  Kernel Bootline Command Parameter Reference 
작성일시 : 2007. 9. 15. 11:54 | 분류 : 컴퓨터/LINUX

console 
The console settings. When using this option, you will need to specify the serial console port and baud rate. For example: console=ttyS0,38400 where ttyS0 is the serial console port and 38400 is the baud rate for the serial port. Another example: console=ttyS0,384008N1 where 8 is is data bits, N is odd parity and 1 is stop bits.
maxcpus=<number> 
Allows to limit the number of processors to be used on a multiprocessor systems.
nfsroot 
If the root filesystem for a board is mounted from a remote NFS server, this option can be used to specify the NFS server and the NFS filesystem. This option can be used as: nfsroot=<server-name>:<remote filesystem>. For example: nfsroot=10.0.0.139:/opt/mips_le_fs, where 10.0.0.139 is the NFS server name and /opt/mips_le_fs is the remote filesystem exported by the NFS server.
nofpu 
Can be used to disable the FPU entirely. In this the kernel FPU emulation will take over floating point processing. Useful if a FPU is known to be defective, has accuracy problems and wrongly detected as present even though none exists.
nosmp 
Disable SMP. Same as maxcpus=0.
nowait 
Disable the use of the wait instruction for powersaving.
rd_start 
The base address of a loaded ramdisk image. This option was added in Linux 2.6.10-rc2. See also rd_size.
rd_size 
The size of a loaded ramdisk image. This option was added in Linux 2.6.10-rc2. See also rd_start.
root 
This option is used to specify the root filesystem. For example, if the root filesytem resides on the second partition of a SCSI device /dev/sda, then this can be specified as: root=/dev/sda2. Similarly, when the root filesystem is mounted over NFS, root=/dev/nfs can be used.
|
  debian에서 portmap nfsd 재시작 
작성일시 : 2007. 9. 15. 10:50 | 분류 : 컴퓨터/LINUX

/etc/rc2.d/S20nfs-kernel-server restart
/etc/rc2.d/S18portmap restart

|
  [debian] aptitude mirror 바꾸기 
작성일시 : 2007. 9. 14. 15:39 | 분류 : 컴퓨터/LINUX

/etc/apt/sources.list 수정

|
  CYGWIN에서 tftpd 돌리기 
작성일시 : 2007. 9. 11. 16:45 | 분류 : 컴퓨터/LINUX

https://linuxlink.timesys.com/docs/windows_tftp


Configuring a TFTP Server for Windows

On Windows systems, the TFTP daemon is controlled by the Extended Internet Services Daemon (xinetd). To configure the TFTP daemon, use the following general procedure:

  1. Create the file /etc/xinetd.d/tftp.
  2. Optionally, disable unnecessary xinetd services.
  3. Add xinetd as a Windows service and restart it, as described in Restarting Required Services on Windows.

All of these files are located in the directory where you have Cygwin installed.

Note

If you use a Windows-provided editor to create text files, they might contain DOS-style line breaks. Use the dos2unix utility in Cygwin to convert the files for use in a UNIX-style system. Issue the command dos2unix --help for details about this utility.

Creating the TFTP Server File

Create the file /etc/xinetd.d/tftp with the contents shown in the following listing:

# default: off
# description: The tftp server serves files using the
# trivial file transfer protocol.  The tftp protocol
# is often used to boot diskless workstations, download
# configuration files to network-aware printers, and
# to start the installation process for some
# operating systems.
 
service tftp
{
     disable       = no
     socket_type   = dgram
     protocol      = udp
     wait          = yes
     user          = SYSTEM
     server        = /usr/sbin/in.tftpd
     server_args   = /tftpboot
     per_source    = 11
     cps           = 100 2
     flags         = IPv4
}

Note

The files in the xinetd.d directory must have read/write permissions set for all users. Generally the touch command is sufficient; however, this depends on how your host machine is configured. If necessary, use the chmod command to change permissions, as in the following example:

$ chmod a+rw /etc/xinetd.d/* 

Disabling Unnecessary xinetd Services

To avoid conflicts and possible security risks, you can disable all services of the xinetd daemon except for TFTP. This step is optional.

To disable unnecessary services, edit the xinetd configuration file, /etc/xinetd.conf, to add the enabled line as shown in the following example:

 # Simple configuration file for xinetd
 # Some defaults, and include /etc/xinetd.d/
 
 defaults
 {
     instances        = 60
     log_type         = FILE /var/log/servicelog
     log_on_success   = HOST PID
     log_on_failure   = HOST
     cps              = 25 30
     enabled          = tftp
 }
 includedir /etc/xinetd.d

The enabled line disables all services except those that are specified. If this line is not used, all services are enabled by default.

|
  CYGWIN 에서 nfs 서버 돌리기 
작성일시 : 2007. 9. 10. 15:57 | 분류 : 컴퓨터/LINUX

1. cygwin 설치
추가패키지
-vim
-nfs-server
-sunrpc
-cygrunsrv

2. 설치가 완료된 후  /etc/exports 수정
/filesystem (rw,all_squash) 라인 추가

3.윈도우에서 cygwin portmap 재시작

4.완성>_<

참조 : http://www.csparks.com/CygwinNFS/index.xhtml

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

Cygwin NFS Server HOWTO

Version 1.9, June 23, 2006
Hugh Sparks

This document shows how to install a minimal Cygwin enviroment to host an NFS server. I wrote this up to help windows users who are not familiar with Linux conventions so the fussy details are all presented.

If you're using Windows XP, be sure to check out the last sections on firewall and network device problems before you try testing your configuration.

Please read the official documentation first

Things often change in the Cygwin project and I only maintain this page when I update my own Cygwin and find the nfs server broken. You really must read the official nfs-server documentation and attempt to follow those directions because they take precidence over anything you read on this site. After installing Cygwin and the nfs-server (see below) you will find the documentation here:

	/usr/share/doc/Cygwin/nfs-server-x.y.z.README 

Please don't bother the cywin mailing lists or nfs-server maintainers until you have tried to follow the instructions in the offical README.

If you find discrepancies between the README documentation and this HOWTO, I will very much appreciate an email from you. Please include the version of Cygwin and nfs-server you have installed.

Installing Cygwin

You need a directory for the Cygwin installation. It seems to be lucky for this program to be at the top level of your C drive. If you feel adventurous, try putting it somewhere else, otherwise, create this directory:

	c:\Cygwin 

You will also need a place to archive the Cygwin packages. This should be where you keep other installers. For this example, we create the directory:

	e:\CygwinInstaller 

Enter this string in your browser's address bar:

	http://www.cygwin.com/setup.exe 

Download the installer (setup.exe) to:

	e:\CygwinInstaller 

Now run the setup.exe program. Press Next on the splash window and select

	Install from Internet 

Press Next.
Your root directory should be:

	c:\Cygwin 

Select: "Install For: All Users"
Select: "Default Text File Type: Unix"
Press Next.
Specify your local package directory: (for example)

	e:\CygwinInstaller 

Press Next. Select: "Direct Connection" Press Next.

Choosing a mirror is tricky. You want to find a fast one. I've had good luck with:

	http://cygwin.get-software.com 

Press Next.
If you have chosen wisely, a list of packages will rapidly appear in the setup window.

Installing extra packages

Several packages are needed beyond the default installation. If you've been messing around, press the "View" button repeatedly to cycle through to the "Category" view.

Adding vim:
Click on the + sign next to the Editors category. Scroll down to find the "vim" item and click on the word "Skip." Each time you click in this area, the text will change, scrolling through the available versions of the package. Often, it is a good idea to select the most recent version of the package. For example, "6.2-3". The box in the "Bin?" column should be checked automatically.

Adding nfs-server:
Click on the + sign next to the Net category. Scroll down to find the nfs-server item and click on the word "Skip" so it becomes "Install." Select a recent version of the package. Note: The nfs-server is fairly new, so if you don't see it in the Net category, back out and try a different Cygwin server.

Adding sunrpc:
This component is found in the Libs category. Scroll down to find the sunrpc item and click on the word "Skip" until it becomes "Install." Select a recent version of the package.

Adding cygrunsrv:
This utility lets you configure the nfs server as a Windows system service. Click on the + sign next to the Admin category. Scroll down to find the cygrunsrv item and click on the word "Skip". Select a recent version of the package.

Press Next.
All your packages as well as any packages they require will be downloaded and installed.

Configuring the server

Run the configuration script

In the cygwin shell window, run:

	/usr/bin/nfs-server-config 

A number of warnings will appear about you installing cygwin for a single user, even though you didn't. You can ignore these complaints.

Editing the configuration files

You probably need to learn the "vi" editor so you can easily create or modify Cygwin configuration files without installing all of X-Windows to support a GUI editor. You will be annoyed if this is your first exposure to vi. Give in. Learn it. It Is Your Destiny.

Otherwise, use Notepad and find some way to convert from windows to unix text format. (Try the drag-n-drop programs uf2d and df2u.)

Host access control files

If you perform the installation of cygwin as described above, you will not need to edit /etc/hosts.allow or /etc/hosts.deny. If you have installed tcp-wrappers by accident or because you decided to install everything, you will need to edit them:

Edit:

	/etc/hosts.allow 

To enable access by just one host:

	nfsd: 148.150.62.152 

To enable an entire subnet:

	nfsd: 148.150.0.0/255.255.0.0 

Edit

	/etc/hosts.deny

Comment out any lines that appear in this file. It will be empty unless you have chosen to install other Cygwin network packages.

The hosts.allow and hosts.deny files support more complex authorization schemes. See "man hosts_acccess" and "man hosts_options" if you need more precise control.

Export directories

Edit:

	/etc/exports 

This is where you export local directories.

This example exports the /pub directory to everyone in the 148.150.62 subnet.

	/pub 148.150.62.0/255.255.255.0(ro, no_root_squash) 

The option "ro" means read-only. Use "rw" for read-write.

You cannot use the wildcard "*" in host numbers:

	No:  148.150.62.* 

You can use the wild card in host names:

	Yes: *.mts.com 

To use ip names, the name must be a real DNS name or it must in your /etc/hosts file.

Note: The Cygwin hosts file: /etc/hosts is actually a shortcut to your windows hosts file at:

	c:\winnt\system32\drivers\etc\hosts 

For some reason, nfs mounts are MUCH faster if you don't authorize entire subnets. It is better to list specific hosts.

Per-user authorization

If the user and group numbers on the client machine match those of an authorized user on the server, access is allowed based on the privilages granted to the user on the server.

Note: You can only have users & permissions in Cygwin if you are using NTFS in windows. If you have FAT32, you must connect as root from the remote system.

The root account is special. Access is never allowed to remote root users unless the "no_root_squash" option is used (as shown in the example above.)

The easy way is to access the server from a client running as root and use the no_root_squash option.

Starting the server

Run:

	Start Menu/Programs/Administrative Tools/Services 

	Someone reported that with the Windows XP "Fisher Price"
	configuration, the Services menu has this path:

	Start Menu/Control Panel/Administrative Tools/Services 

There are three services associated with NFS:

	Cygwin mountd
	Cygwin nfsd
	Cygwin portmap 

Right-click on each of these and use the pop-up menu to start all three servers. You will find that portmap starts automatically when you start either nfsd or mountd first. There is a dependency between system services that Windows tries to maintain automatically.

After editing any of the configuration files the /etc directory, you must restart these services. Because mountd and nfsd are configured to depend on portmap, it is sufficent to right-click on portmap and select "restart." A dialog will appear to confirm that you also want to restart mountd and nfsd.

Mounting an nfs share on the client machine

The client machine in the following example is assumed to be a Linux or other Unix system. If you have a nice free NFS client for Windows, I'd like to hear about it so I can add a link on this page.

For this example, we assume that the NFS server running on your Windows machine has an ip name "remote" and an exported directory "/pub" defined under /etc/exports as shown above.

The name "remote" only has to be defined on the Linux/Unix client. You can define the name in /etc/hosts or just use the ip number of your Windows server in the following example.

Log into your client machine. You probably need to be "root" to mount the remote nfs directory.

Create a local directory:

	mkdir /mnt/there 

Mount the share:

	mount -t nfs remote:/pub /mnt/there 

You should now be able to poke around in /mnt/there, and see any files located in the "/pub" directory on the Cygwin/Windows side.

Important update: A reader of this HOWTO has discovered that CygwinNFS does not support NFS version 3, which is now the default in Linux. To overcome this problem you must add an option to the mount command line: "-overs=2" The full command line becomes:

	mount -t nfs -o nfsvers=2 remote:/pub /mnt/there 

An alternative specification using "vers" also works on Linux and other Unix-like systems:

	mount -t nfs -o vers=2 remote:/pub /mnt/there 

(Thanks to Mr. Ostrozhansky!)

Exporting other Windows directories

If you run "mount" with no parameters in the cygwin shell, you will see a list of mounted directories.

The Windows root directories, c:\, d:\ etc will also appear in this list. They are accessed through the special path names /cygdrive/c, /cygdrive/d etc. If you visit the root "/" of cygwin, you will find that these mount points don't actually exist. If you try to list them in the nfs /etc/exports file, they will fail to mount on the client system.

This is probably a bug, but there is a simple work-around:

Create a directory for each Windows volume you want to export and then mount them directly to the windows pathname:

Make directories to use as mount points:

	mkdir -p /mnt/c
	mkdir -p /mnt/d 

Mount the windows directories:

	mount c:/ /mnt/c
	mount d:/ /mnt/d 

Now you can export these directories in /etc/exports:

	/mnt/c myClient.com(rw, no_root_squash)
	/mnt/d myClient.com(rw, no_root_squash) 

Don't forget to restart the portmap service in Windows.

You may be worried about what happens to your mounts when you reboot windows: They are stored in the registry, rather than /etc/fstab. After a reboot, they are restored and they will be available to remote systems via NFS.

In fact, if you reboot windows when an nfs mount was created on a remote client, the mounted files will still be available after windows reboots.

Uninstalling Cygwin

Stop the services:

	cygrunsrv --stop mountd
	cygrunsrv --stop nfsd
	cygrunsrv --stop portmap 

Remove the services:

	cygrunsrv --remove mountd
	cygrunsrv --remove nfsd
	cygrunsrv --remove portmap 

If you use Cygwin to run other services such as X-Windows, you should stop these processes now.

Exit the shell and run the Cygwin setup.exe Use the "View" button repeatedly to cycle to the "Category" view, then click on the "Default" text next to category "All" to cycle through until you see Uninstall.

Press Next-> to remove everthing.

Cygwin is one of those programs that doesn't really like to be uninstalled. To finish the job, delete everything in your c:\cygwin directory. You may find that you need to stop residual cygwin processes with the Task Damager before you can delete everthing in the Cygwin folder. Reboot if necessary.

Next, run Regedit and search for cygwin. Delete all the keys you find and any surrounding "Cygnus Solutions" folders.

Windows XP Issues

Many people report trouble running the NFS server under Windows XP. Since service pack 2, XP has a firewall which will block NFS connections by default.

An additional difficulty occurs because the nfs system services won't start when certain network devices are enabled but disconnected.

Dealing with the firewall

You need to enable selected ports and programs to bypass Windows Firewall. The following windows show the required changes:


Firewall nfs tcp settings


Firewall nfs udp settings


Firewall portmap TCP settings


Firewall portmap UDP settings


Firewall mountd settings

On each of the configuration windows shown above, there is a Change scope button. This brings up a window where you can restrict the action of opening the firewall to your local LAN. If you don't plan to operate NFS over the internet, this is a very good idea:


Firewall scope settings

Dealing with conflicting network devices

The symptom this problem creates is that nfsd and mountd won't start. It appears that these services refuse to start if any network device is enabled but currently disconnected.

If you have a wireless lan card, bluetooth device or other network devices that are only occasionally connected, you will probably encounter problems running the nfs-server.

Here's a quick way to find out which network devices are blocking NFS: Bring up the System Services panel and locate the Cygwin portmap service. You can right-click on this item to bring up a menu that will allow you to restart the portmap. Because nfsd and mountd depend on portmap, they will offer to restart as well.


System services

You can also right-click on devices displayed in the Device Manager panel. A menu pops up that will let you disable the selected device.

Go through the list and disable all the network devices except for the ones associated with your currently active connection(s). Then try restarting the portmap and see if nfsd and mountd start correctly. In every case I've seen or heard about, this strategy works.

The following Device Manager list shows the devices (with the red X) I needed to disable. When I need to use one of these devices, I can re-enable them and nfs continues to operate. (As long as it starts first.)


Disable offending network devices

Complaints and Suggestions

Let me know...

|
  리눅스 환경에서 분할압축하기 
작성일시 : 2007. 9. 5. 17:41 | 분류 : 컴퓨터/LINUX

압축하기
tar czvf - /tmp/* | split -b 1m - test.tar.gz
->tar는 /tmp의 모든 파일을 압축하되 압축한 내용을 std로 보내고(-) split은 std의 데이터를 1메가 단위로 분할해 test.tar.gz란 이름을 prefix로 하는 파일을 만든다.

압축 풀기
cat test.tar.gz* | tar xzvf -
|
  VI Tips 
작성일시 : 2007. 8. 23. 20:56 | 분류 : 컴퓨터/LINUX

블록 선택
Ctrl + v

indent 정리
=

함수 폴딩
설정 zf
해제 zo

함수 범위 확인
%

파일 탐색하여 열기
:10vs.
10 창크기
vs verticalscreen
. 디렉토리

파일 처음과 끝 이동
처음 :1
끝 :$

되살리기 되돌아가기
되살리기 u
되돌리기 ctrl+r

창 분할 후 사이즈 조절
ctrwl+w N+ 가로 N만큼 늘리기
ctrwl+w N- 가로 N만큼 줄이기
ctrwl+w N> 가로 N만큼 오른쪽으로 늘리기
ctrwl+w N< 가로 N만큼 왼쪽으로 늘리기

편집중에 수행한 명령의 출력 불러오기
:r !command

블록 선택해서 주석 설정 해제하기
설정 :norm i//
해제 :norm 2x




|
 Prev   1   2   Next