当前位置:首页 » 币种行情 » eth1234567

eth1234567

发布时间: 2022-04-30 07:23:59

A. C语言问题,急救.

1. 用isalpha(stu[i].num[j]) 和 isdigit(stu[i].num[j])

do{
key = 1;
for(i=0; i<2 && key = 1; i++)
if(!isalpha(input[i]))
key=0;
for(i=2; i<9 && key = 1; i++)
if(!isdigit(input[i]))
key=0;
if(key == 1)
strcpy(stu[j].num, input)
}while(key==0);

2. 当拿x值是用 x=toupper(getchar());
while(x != 'Y' || x != 'N'){
printf("Invalid value pls enter again[y]yes [n] no> ");
x=toupper(getchar());
}

3.当然你的学号需要改成string
#include<string.h>里的
if(strcmp(input,stu[i].num) == 0)
这表示他们两个是一样的

#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#define N 5

struct student{
char num[10]; //ѧºÅ
char name[10]; //ÐÕÃû³¤¶È
float score1;
float score2;
float score3;
float score; //ƽ¾ù³É¼¨
}stu[N]={
{"1", "Àî1",45,45,45,45},
{"2", "Àî2",46,46,46,46},
{"3", "Àî3",47,47,47,47},
{"4", "Àî4",48,48,48,48},
{"5", "Àî5",49,49,49,49}};

del();
int chacknum(char*);
int scan(char*, int*);

int i,m;

void main(){
for (i=0;i<N;i++){
printf("ѧºÅ%d \nÐÕÃû%s\n³É¼¨1%7.2f\n³É¼¨2%7.2f\n³É¼¨3%7.2f\nƽ¾ù³É¼¨%7.2f\n",
stu[i].num,stu[i].name,stu[i].score1,stu[i].score2,stu[i].score3,stu[i].score);
}
del();
}

del(){
char x;
char input[10];
int j,i=N;

for(;;){
printf("ɾ³ýѧÉúÐÅÏ¢\n");
printf("ÊÇ·ñɾ³ýѧÉúÐÅÏ¢(y/n)");
fflush(stdin);
x=toupper(getchar());
while(x != 'Y' && x != 'N'){
printf("You are enter invalid value pls enter again > ");
fflush(stdin);
x=toupper(getchar());
}
printf("\n");
if(x=='Y'){
printf("ÊäÈëҪɾ³ýѧԱѧºÅ:");
fflush(stdin);
gets(input);
printf("\n");
if(scan(input, &j) == 0){
printf("No this ID\n");
continue;
}
i--;
for(;;){
stu[j]=stu[j+1];
j++;
if(!strlen(stu[j].num))
break;
}
for(j=0;j<i;j++)
if (stu[j].num!=0)
printf("ѧºÅ%s \nÐÕÃû%s\n³É¼¨1%7.2f\n³É¼¨2%7.2f\n³É¼¨3%7.2f\nƽ¾ù³É¼¨%7.2f\n",
stu[j].num,stu[j].name,stu[j].score1,stu[j].score2,stu[j].score3,stu[j].score);
}else if(x == 'N')
break;
system("pause");
system("cls");
}
}

int chacknum(char num[]){
int key=1, i;
if(strlen(num) != 9)
key = 0;
for(i=0; i<2 && key == 1; i++)
if(!isalpha(num[i]))
key = 0;
for(i=2; i<9 && key == 1; i++)
if(!isdigit(num[i]))
key = 0;
return key;
}

int scan(char input[], int *j){
int i, key = 0;
for(i=0; i<5 && key == 0; i++)
if(strcmp(stu[i].num,input) == 0){
key = 1;
break;
}
*j = i;
return key;
}

B. 汉字谐音的对联有哪些

谢谢你发来的求助,我感到非常荣幸,这是我找到的一些资料,希望能够帮到你!

二猿断木深山中,小猴子也敢对锯(句)
一马陷足污泥内,老畜生怎能出题(蹄) --解 缙

因荷而得藕,(因何而得偶)
有杏不须梅,(有幸不须媒)

狗啃河上(和尚)骨 --苏 轼
水流东坡诗(尸) --佛 印

向阳门第春常在 --苏 轼
积善人家庆(罄)有余(鱼) --佛 印

师姑田上担禾上(和尚)
美女堂前抱绣裁(秀才)

孔子生于舟(周)未
光舞(武)起自汉中 光舞:闪电;汉中:天空

灯笼笼灯,纸(枳)壳原来只防风
鼓架架鼓,陈皮不能敲半下(夏)

莲(连)子心中苦
梨(离)儿腹内酸 --金圣叹

身居宝塔,眼望孔明,怨江围实难旅步
鸟处笼中,心思槽巢,恨关羽不得张飞 --(内江三元塔楹联)
孔明(诸葛亮)江围(姜维)旅步(吕布)槽巢(曹操)关羽 张飞
两舟竞渡,橹速不如帆快
百管争鸣,笛清难比萧和
橹速、帆快、笛清、萧和分别谐音三国人物:鲁肃,攀哙,狄青,萧何

上联:和尚过河,手掣荷花何处插?
下联:侍郎游市,眼前柿树是谁栽?
新联:委员入闱,脸上威风为甚猥!(无情)

上联:何所长,何所长,何所长因何当所长。

上联:先生磨墨,墨溅先生两脉墨。
下联:枚香烧煤,煤爆枚香双眉煤。
下联:牧童伐木,木伤牧童二目木。

上联:树上桐子,树下童子,童子打桐子,桐子落童子乐。
下联:屋前园外,屋内员外,员外扫园外,园外净员外静。
新联:院后廊中,院里郎中,郎中行廊中,廊中幽郎中悠。(无情)

上联:蒲叶桃叶葡萄叶,草本木本。
下联:梅花桂花玫瑰花,春香秋香。

上联:霜降降霜,谁怜孀妇双脚冷。
下联:谷雨雨谷,我惜姑娘孤身寒。

上联:宝塔六七层,中容大鹤。
下联:通书十二页,里记春秋。
新联:家谱四五笔,上书老子。

调琴调新调调调调来调调妙
种花种好种种种种成种种香

上联:一、三、八字读音 (条),调整的 (调),其余读音(掉),音调的(调)。
下联:一、三、八字读去音,种植的 (种),其余读上音,品种,种类的(种)。

朝朝朝朝朝朝汐
长长长长长长消

上联读音:朝朝潮,朝潮朝汐。
下联读音:长长涨,长涨长消。

行行行行行行行
长长长长长长长

上联读音:杭行杭行杭杭行。
下联读音:长涨长涨长长涨。

乐乐乐乐乐乐乐
朝朝朝朝朝朝朝

上联读音:骆曰,骆曰,骆骆曰。
下联读音:招潮,招潮,招招潮。

朝云朝朝朝朝朝朝朝退
长水长长长长长长长流

上联读音:朝云潮,朝朝潮,朝朝朝退。
下联读音:长水涨,长长涨,长涨长流。

海水朝朝朝朝朝朝朝落
浮云长长长长长长长消

上联读音:海水潮,朝朝潮,朝潮朝落。
下联读音:浮云涨,长长涨,长涨长消。

酒热不须汤盏汤
厅来无用扇车扇

上联后一「汤」读「烫」
下联后一「扇」读「煽」

C. 1234567的英语的基数词的序数词

a.从第一至第十九
其中,one-first,two-second,three-third,five-fifth,eight-eighth,nine-ninth,twelve-twelfth为特殊形式,其它的序数词都是由其相对应的基数词后面添加“th”构成。例如:six-sixth、nineteen-nineteenth.
b.从第二十至第九十九
整数第几十的形式由其对应的基数词改变结尾字母y为i,再加“eth”构成。
twenty--twentieththirty--thirtieth
表示第几十几时,用几十的基数词形式加上连字符“-”和个位序数词形式一起表示。
thirty-first第三十一
fifty-sixth第五十六
seventy-third第七十三
ninety-ninth第九十九

D. 青少年电子手表的1234567 7天的日期怎么调

从最出界面开始,显示的是时间 SUMOTUWETHFRSR 星期日星期一星期二星期三星期四星期五星期六 LIGHT:灯光 1按一次MODE进入秒表 1.1按一次ST/SP开始计时,再按ST/SP停止计时 2按二次MODE进入闹钟调整 2.1按RESET更改选项,按ST/SP调整时间 3按三次MODE进入时间日期星期调整 3.1、按ST/SP调整秒 3.2、按一次RESET,按ST/SP调整分 3.3、按二次RESET,按ST/SP调整小时(可以选择12小时的或24小时的) 3.4、按三次RESET,按ST/SP调整日 3.5、按四次RESET,按ST/SP调整月 3.6、按五次RESET,按ST/SP调整星期 闹钟调整:从最出界面开始,同按时按ST/SP和RESET是闹钟开关,同时要注意 上面会有个小铃铛图案或别的显示闹钟开关。闹钟响后按RESET关 闭闹钟,若按ST/SP暂时停止闹钟,五分钟后会在响。

E. flash键盘钢琴 1234567=键盘英文

你是要KEYCODE是吧。。。。

keycode 8 = BackSpace BackSpace
keycode 9 = Tab Tab
keycode 12 = Clear
keycode 13 = Enter
keycode 16 = Shift_L
keycode 17 = Control_L
keycode 18 = Alt_L
keycode 19 = Pause
keycode 20 = Caps_Lock
keycode 27 = Escape Escape
keycode 32 = space space
keycode 33 = Prior
keycode 34 = Next
keycode 35 = End
keycode 36 = Home
keycode 37 = Left
keycode 38 = Up
keycode 39 = Right
keycode 40 = Down
keycode 41 = Select
keycode 42 = Print
keycode 43 = Execute
keycode 45 = Insert
keycode 46 = Delete
keycode 47 = Help
keycode 48 = 0 equal braceright
keycode 49 = 1 exclam onesuperior
keycode 50 = 2 quotedbl twosuperior
keycode 51 = 3 section threesuperior
keycode 52 = 4 dollar
keycode 53 = 5 percent
keycode 54 = 6 ampersand
keycode 55 = 7 slash braceleft
keycode 56 = 8 parenleft bracketleft
keycode 57 = 9 parenright bracketright
keycode 65 = a A
keycode 66 = b B
keycode 67 = c C
keycode 68 = d D
keycode 69 = e E EuroSign
keycode 70 = f F
keycode 71 = g G
keycode 72 = h H
keycode 73 = i I
keycode 74 = j J
keycode 75 = k K
keycode 76 = l L
keycode 77 = m M mu
keycode 78 = n N
keycode 79 = o O
keycode 80 = p P
keycode 81 = q Q at
keycode 82 = r R
keycode 83 = s S
keycode 84 = t T
keycode 85 = u U
keycode 86 = v V
keycode 87 = w W
keycode 88 = x X
keycode 89 = y Y
keycode 90 = z Z
keycode 96 = KP_0 KP_0
keycode 97 = KP_1 KP_1
keycode 98 = KP_2 KP_2
keycode 99 = KP_3 KP_3
keycode 100 = KP_4 KP_4
keycode 101 = KP_5 KP_5
keycode 102 = KP_6 KP_6
keycode 103 = KP_7 KP_7
keycode 104 = KP_8 KP_8
keycode 105 = KP_9 KP_9
keycode 106 = KP_Multiply KP_Multiply
keycode 107 = KP_Add KP_Add
keycode 108 = KP_Separator KP_Separator
keycode 109 = KP_Subtract KP_Subtract
keycode 110 = KP_Decimal KP_Decimal
keycode 111 = KP_Divide KP_Divide
keycode 112 = F1
keycode 113 = F2
keycode 114 = F3
keycode 115 = F4
keycode 116 = F5
keycode 117 = F6
keycode 118 = F7
keycode 119 = F8
keycode 120 = F9
keycode 121 = F10
keycode 122 = F11
keycode 123 = F12
keycode 124 = F13
keycode 125 = F14
keycode 126 = F15
keycode 127 = F16
keycode 128 = F17
keycode 129 = F18
keycode 130 = F19
keycode 131 = F20
keycode 132 = F21
keycode 133 = F22
keycode 134 = F23
keycode 135 = F24
keycode 136 = Num_Lock
keycode 137 = Scroll_Lock
keycode 187 = acute grave
keycode 188 = comma semicolon
keycode 189 = minus underscore
keycode 190 = period colon
keycode 192 = numbersign apostrophe
keycode 210 = plusminus hyphen macron
keycode 211 =
keycode 212 = right registered
keycode 213 = guillemotleft guillemotright
keycode 214 = masculine ordfeminine
keycode 215 = ae AE
keycode 216 = cent yen
keycode 217 = questiondown exclamdown
keycode 218 = onequarter onehalf threequarters
keycode 220 = less greater bar
keycode 221 = plus asterisk asciitilde
keycode 227 = multiply division
keycode 228 = acircumflex Acircumflex
keycode 229 = ecircumflex Ecircumflex
keycode 230 = icircumflex Icircumflex
keycode 231 = ocircumflex Ocircumflex
keycode 232 = ucircumflex Ucircumflex
keycode 233 = ntilde Ntilde
keycode 234 = yacute Yacute
keycode 235 = oslash Ooblique
keycode 236 = aring Aring
keycode 237 = ccedilla Ccedilla
keycode 238 = thorn THORN
keycode 239 = eth ETH
keycode 240 = diaeresis cedilla currency
keycode 241 = agrave Agrave atilde Atilde
keycode 242 = egrave Egrave
keycode 243 = igrave Igrave
keycode 244 = ograve Ograve otilde Otilde
keycode 245 = ugrave Ugrave
keycode 246 = adiaeresis Adiaeresis
keycode 247 = ediaeresis Ediaeresis
keycode 248 = idiaeresis Idiaeresis
keycode 249 = odiaeresis Odiaeresis
keycode 250 = udiaeresis Udiaeresis
keycode 251 = ssharp question backslash
keycode 252 = asciicircum degree
keycode 253 = 3 sterling
keycode 254 = Mode_switch 本篇文章来源于:开发学院 http://e.codepub.com 原文链接:http://e.codepub.com/2009/0416/2997.php

F. linux 怎么解决failed to update rate sets in kernel mole

Cybergibbons
Reverse engineer, hardware hacker, security analyst, lock picker, heist planner. Definitely not involved in the Hatton Garden job.
Search
Menu
SKIP TO CONTENT
HOME
ABOUT
BENEFITS
CONTACT
PGP KEY

Quick and easy fake WiFi access point in Kali
POSTED ON FEBRUARY 4, 2015 BY CYBERGIBBONS
I’m working on a project at the moment that requires me to observe traffic from an iOS/Android app to various external IPs.
The easiest way to do this is to setup a fake WiFi access point and use Wireshark to sniff the traffic. This is very easy in Kali Linux.
1. Connect the Kali box to the Internet
On my machine, this is as simple as connecting to my WiFi network “DoingAJob5G” using the built-in wireless card on my x220. I use the GUI provided with Kali.
Using ifconfig I can see that this adapter is called wlan0.
You could use wired Ethernet, then in all likelihood this will be eth0 instead.
2. Connect an external WiFi adapter that is supported by hostapd
I’m using a USB TP-LINK TL-WN722N which is using an Atheros AR9271 chipset. These are cheap (£8-£10), powerful and reliable.
I suspect many USB WiFi adapters are compatible with hostapd, unfortunately I can’t see a clear source documenting which ones.
Check it works by connecting to any network using Kali’s GUI. This will save you hassle later if there are any driver or hardware issues.
3. Bring up the new wireless interface.
Use ifconfig -a to see the new wireless interface name:

1
2
3
4
5
6

wlan3 Link encap:Ethernet HWaddr c0:4a:00:1e:64:fd
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Bring this up as the gateway for your new wireless network. I am using 10.0.0.1/24 simply to avoid any chance of confusion with my internal NATed 192.168.0.1/24 network.

1
2
3
4
5
6
7
8
9

root@kali:~# ifconfig wlan3 10.0.0.1/24 up
root@kali:~# ifconfig wlan3
wlan3 Link encap:Ethernet HWaddr c0:4a:00:1e:64:fd
inet addr:10.0.0.1 Bcast:10.0.0.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

4. Configure and run DHCP and DNS services
DHCP assigns IP addresses when clients connect, and DNS provides resolution of names to IPs.
Most wireless clients expect DHCP by default, so it is convenient to run a DHCP server. You can manually set IP addresses, but it’s really easier to do DHCP.
Running our own DNS server means that we can easily intercept and alter DNS queries, which can assist in setting up man-in-the-middle attacks.
A piece of software called dnsmasq does both DHCP and DNS and is very simple to setup.
First, install dnsmasq:

1

apt-get install dnsmasq

Next, create a config file dnsmasq.conf as follows:

1
2
3
4
5
6
7

interface=wlan3
dhcp-range=10.0.0.10,10.0.0.250,12h
dhcp-option=3,10.0.0.1
dhcp-option=6,10.0.0.1
server=8.8.8.8
log-queries
log-dhcp

This is about as simple as it gets. Only listen on wlan3, our additional wireless adapter. Hand out DHCP addresses from 10.0.0.10-10.0.0.250. DHCP option 3 is the gateway, DHCP option 6 is the DNS server – both of these should be set to our wlan3 IP of 10.0.0.1. serverspecifies upstream DNS servers that will handle most DNS queries – I have provided Google’s DNS server of 8.8.8.8. Finally, log DNS queries and DHCP requests – this just makes it easier to check everything is working.
We also want to create a file fakehosts.conf to allow us to spoof certain DNS requests:

1

10.0.0.9 neohub.co.uk

This will cause the dnsmasq DNS server to respond with 10.0.0.9 to any request forneohub.co.uk.
We then need to bring dnsmasq up. I want it to run with output to stderr, so this is done as follows:

1

dnsmasq -C dnsmasq.conf -H fakehosts.conf -d

5. Configure and run hostapd
Next, we need to get our wireless adapter to run as a access point.
hostapd allows us to do this.
Install hostapd:

1

apt-get install hostapd

Create a config file hostapd.conf:

1
2
3
4

interface=wlan3
driver=nl80211
ssid=Kali-MITM
channel=1

Again – really simple. Use our additional wireless adapter wlan3 with the nl80211 drivers (which seem to cover pretty much all modern adapters than can be APs), set the SSID to Kali-MITM and set the channel to 1. There is no encryption etc. but I really don’t need or want it for sniffing traffic.
Then start hostapd:

1
2
3
4

root@kali:~# hostapd ./hostapd.conf
Configuration file: ./hostapd.conf
Failed to update rate sets in kernel mole
Using interface wlan3 with hwaddr c0:4a:00:1e:64:fd and ssid 'Kali-MITM'

6. Setup routing for the access point
You want a very simple setup at the moment – act as a basic NAT gateway between wlan3and wlan0.
Without going into any detail, the following commands will set this up:

1
2
3

sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -P FORWARD ACCEPT
sudo iptables --table nat -A POSTROUTING -o wlan0 -j MASQUERADE

At this stage, you should now be able to connect to Kali-MITM, get an IP address, and start using the Internet.

G. ubuntu 如何修改网卡名称

方案一:
1,首先修改网卡物理配置文件,没有这个文件的话新建一个或者从已有的环境上拷贝一份过来按照要求进行修改
vi /etc/udev/rules.d/70-persistent-net.rules
# PCI device 0x14e4:0x1692 (tg3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="bc:30:5b:b1:cd:be", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

关键字解释:
ATTR{address}=="bc:30:5b:9c:ae:79" ##物理网卡MAC地址 ifconfig查看
KERNEL=="eth*" ##原网卡名
NAME="eth0" ##现网卡名1234567

需要把这个文件中网卡的MAC地址,原网卡名字以及需要改成的网卡名字配置进去。
2,修改网落配置文件
vi /etc/network/interfaces
auto eth0
iface eth0 inet static
address 172.16.19.XX
netmask 255.255.255.0

这个要配置成修改后新的网卡名字
auto eth0 ##网卡名对应要正确1234567

3,重启服务器
重启物理服务器有一定的风险服务器没有重启起来,个人测试环境比较老旧有出现过服务器重启不起来,或者重启起来服务器因为网络配置错误出现失联情况,提示:在进行网卡修改的时候最好服务器离自己比较近,不要在远程的方式下进行修改,防止服务器失联。
三、方案二:
在/etc/default/grub中,GRUB_CMDLINE_LINUX里添加参数net.ifnames=0 biosdevname=0,如下图所示:

然后在命令行执行,update-grub,最后,修改/etc/network/interfaces文件,
将网卡名改为eth0
重启系统,网卡名更改成功,当然这里也会出现服务器失联的情况需要注意。
阅读全文

H. linux运维工程师面试问不问面试题

1

mount.cifs //192.168.1.3/server /mnt/server -o user=administrator,pass=123456

linux 下的server需要自己手动建一个 后面的user与pass 是windows主机的账号和密码 注意空格 和逗号
2.查看http的并发请求数与其TCP连接状态

Shell

1

netstat -n | awk '/^tcp/ {++b[$NF]} END {for(a in b) print a, b[a]}'

还有ulimit -n 查看linux系统打开最大的文件描述符,这里默认1024,不修改这里web服务器修改再大也没用。若要用就修改很几个办法,这里说其中一个:
修改/etc/security/limits.conf

Shell

1
2

* soft nofile 10240
* hard nofile 10240

重启后生效
3.用tcpmp嗅探80端口的访问看看谁最高

Shell

1

tcpmp -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr |head -5

4.查看当前系统每个IP的连接数

Shell

1

ls /var/log/ -lR| grep "^-" |wc -l

5.查看当前系统每个IP的连接数

Shell

1

netstat -n | awk '/^tcp/ {print $5}'| awk -F: '{print $1}' | sort | uniq -c | sort -rn

6.shell下32位随机密码生成

Shell

1

cat /dev/urandom | head -1 | md5sum | head -c 32 >> /pass

将生成的32位随机数 保存到/pass文件里了
7.统计出apache的access.log中访问量最多的5个IP

Shell

1

cat access_log | awk '{print $1}' | sort | uniq -c | sort -n -r | head -5

8.如何查看二进制文件的内容
我们一般通过hexmp命令 来查看二进制文件的内容。
hexmp -C XXX(文件名) -C是参数 不同的参数有不同的意义
-C 是比较规范的 十六进制和ASCII码显示
-c 是单字节字符显示
-b 单字节八进制显示
-o 是双字节八进制显示
-d 是双字节十进制显示
-x 是双字节十六进制显示
等等等等
9.ps aux 中的VSZ代表什么意思,RSS代表什么意思
VSZ:虚拟内存集,进程占用的虚拟内存空间
RSS:物理内存集,进程战用实际物理内存空间
10.检测并修复/dev/hda5
fsck用来检查和维护不一致的文件系统。若系统掉电或磁盘发生问题,可利用fsck命令对文件系统进行检查,用法:

11.Linux系统的开机启动顺序

加载BIOS–>读取MBR–>Boot Loader–>加载内核–>用户层init一句inittab文件来设定系统运行的等级(一般3或者5,3是多用户命令行,5是界面)–>init进程执行rc.syninit–>启动内核模块–>执行不同级别运行的脚本程序–>执行/etc/rc.d/rc.local(本地运行服务)–>执行/bin/login,就可以登录了。
12.符号链接与硬链接的区别
我们可以把符号链接,也就是软连接 当做是 windows系统里的 快捷方式。
硬链接 就好像是 又复制了一份.
ln 3.txt 4.txt 这是硬链接,相当于复制,不可以跨分区,但修改3,4会跟着变,若删除3,4不受任何影响。
ln -s 3.txt 4.txt 这是软连接,相当于快捷方式。修改4,3也会跟着变,若删除3,4就坏掉了。不可以用了。
13.保存当前磁盘分区的分区表
dd 命令是以个强大的命令,在复制的同时进行转换

Shell

1

dd if=/dev/sda of=./mbr.txt bs=1 count=512

14..没有14题,我自己来个简单的,如何在文本里面进行复制、粘贴,删除行,删除全部,按行查找和按字母查找。
以下操作全部在命令行状态操作,不要在编辑状态操作。
在文本里 移动到想要复制的行 按yy 想复制到哪就移动到哪,然后按P 就黏贴了
删除行 移动到改行 按dd
删除全部 dG 这里注意G一定要大写
按行查找 :90 这样就是找到第90行
按字母查找 /path 这样就是 找到path这个单词所在的位置,文本里可能存在多个,多次查找会显示在不同的位置。
15.手动安装grub

Shell

1

grub-install /dev/sda

16.修改内核参数
vi /etc/sysctl.conf 这里修改参数
sysctl -p 刷新后可用
17.在1-39内取随机数

Shell

1

echo $[$RANDOM%39]

RANDOM 随机数
%39 取余数
18.限制apache每秒新建连接数为1,峰值为3
每秒新建连接数 一般都是由防火墙来做,apache本身好像无法设置每秒新建连接数,只能设置最大连接:

Shell

1

iptables -A INPUT -d 172.16.100.1 -p tcp --dport 80 -m limit --limit 1/second -j ACCEPT

硬件防火墙设置更简单,有界面化,可以直接填写数字。。。
最大连接 apache本身可以设置
MaxClients 3 ,修改apache最大连接 前提还是要修改系统默认tcp连接数。我博客里也说了,这就不说了。
19.FTP的主动模式和被动模式
FTP协议有两种工作方式:PORT方式和PASV方式,中文意思为主动式和被动式。
PORT(主动)方式的连接过程是:客户端向服务器的FTP端口(默认是21)发送连接请 求,服务器接受连接,建立一条命令链路。当需要传送数据时,客户端在命令链路上用PORT 命令告诉服务器:“我打开了XX端口,你过来连接我”。于是服务器从20端口向客户端的 XX端口发送连接请求,建立一条数据链路来传送数据。
PASV(被动)方式的连接过程是:客户端向服务器的FTP端口(默认是21)发送连接请 求,服务器接受连接,建立一条命令链路。当需要传送数据时,服务器在命令链路上用PASV 命令告诉客户端:“我打开了XX端口,你过来连接我”。于是客户端向服务器的XX端口 发送连接请求,建立一条数据链路来传送数据。
从上面可以看出,两种方式的命令链路连接方法是一样的,而数据链路的建立方法就完 全不同。
20.显示/etc/inittab中以#开头,且后面跟了一个或者多个空白字符,而后又跟了任意非空白字符的行

Shell

1

grep "^# \{1,\}[^ ]" /etc/inittab

21.显示/etc/inittab中包含了:一个数字:(即两个冒号中间一个数字)的行

Shell

1

grep "\:[0-9]\{1\}\:" /etc/inittab

22.怎么把脚本添加到系统服务里,即用service来调用
在脚本里加入

Shell

1
2
3

#!/bin/bash
# chkconfig: 345 85 15
# description: httpd

然后保存
chkconfig httpd –add 创建系统服务
现在就可以使用service 来 start or restart
23.写一个脚本,实现批量添加20个用户,用户名为user1-20,密码为user后面跟5个随机字符

Shell

1
2
3
4
5
6

#!/bin/bash
#description: useradd
for i in `seq -f"%02g" 1 20`;do
useradd user$i
echo "user$i-`echo $RANDOM|md5sum|cut -c 1-5`"|passwd –stdinuser$i >/dev/null 2>&1
done

24.写一个脚本,实现判断192.168.1.0/24网络里,当前在线的IP有哪些,能ping通则认为在线

Shell

1
2
3
4
5
6
7
8
9
10
11
12
13

#!/bin/bash
for ip in `seq 1 255`
do
{
ping -c 1 192.168.1.$ip > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo 192.168.1.$ip UP
else
echo 192.168.1.$ip DOWN
fi
}&
done
wait

25.写一个脚本,判断一个指定的脚本是否是语法错误;如果有错误,则提醒用户键入Q或者q无视错误并退出其它任何键可以通过vim打开这个指定的脚本

Shell

1
2
3
4
5
6
7
8
9
10
11
12

[root@localhost tmp]# cat checksh.sh
#!/bin/bash
read -p "please input check script->" file
if [ -f $file ]; then
sh -n $file > /dev/null 2>&1
if [ $? -ne 0 ]; then
read -p “You input $file syntax error,[Type q to exit or Type vim toedit]” answer
case $answer in
q | Q)
exit 0
;;
vim)

26、写一个脚本:(26包括3个小题)
1、创建一个函数,能接受两个参数:
1)第一个参数为URL,即可下载的文件;第二个参数为目录,即下载后保存的位置;
2)如果用户给的目录不存在,则提示用户是否创建;如果创建就继续执行,否则,函数返回一个51的错误值给调用脚本;
3)如果给的目录存在,则下载文件;下载命令执行结束后测试文件下载成功与否;如果成功,则返回0给调用脚本,否则,返回52给调用脚本;

Shell

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

[root@localhost tmp]# cat downfile.sh
#!/bin/bash
url=$1
dir=$2
download()
{
cd $dir >> /dev/null 2>&1
if [ $? -ne 0 ];then
read -p "$dir No such file or directory,create?(y/n)" answer
if [ "$answer" == "y" ];then
mkdir -p $dir
cd $dir
wget $url 1> /dev/null 2>&1
if [ $? -ne 0 ]; then
return "52"
fi
else
return "51"
fi
fi
}
download $url $dir
echo $?

27、写一个脚本:(27包括2个小题)
1、创建一个函数,可以接受一个磁盘设备路径(如/dev/sdb)作为参数;在真正开始后面步骤之前提醒用户有危险,并让用户选择是否继续;而后将此磁盘设备上的所有分区清空(提示,使用命令dd if=/dev/zero of=/dev/sdb bs=512 count=1实现,注意其中的设备路径不要写错了;
如果此步骤失败,返回67给主程序;
接着在此磁盘设备上创建两个主分区,一个大小为100M,一个大小为1G;如果此步骤失败,返回68给主程序;
格式化此两分区,文件系统类型为ext3;如果此步骤失败,返回69给主程序;
如果上述过程都正常,返回0给主程序;
2、调用此函数;并通过接收函数执行的返回值来判断其执行情况,并将信息显示出来;

Shell

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

local Darray=(`ls /dev/sd[a-z]`)
for i in ${Darray};do
[[ "$i" == "$1" ]] && Sd=$i &&break
done
else
return66
fi
#当匹配成功,进入选择,告诉用户,是否继续,输错的话进入无限循环,当用户选择Y,则清空目标分区,且跳出while循环
while :;do
read -p "Warning!!!This operation will clean $Sd data.Next=y,Quit=n [y|n]:" Choice
case $Choice in
y)
dd if=/dev/zero of=$Sd bs=512 count=1 &> /dev/null &&break || return 67 ;;
n)
exit 88 ;;
*)
echo "Invalid choice,please choice again." ;;
esac
done

#使用echo传递给fdisk进行分区,如果此命令失败,则跳转出去,错误值68,需要注意的是,有时候这个返回值很诡异,笔者之前成功与否都是返回的1,后来重启之后,就好了,如果慎重的话,可以对创建的分区,进行判断,不过就需要使用其他工具截取相关字段了,虽有些小麻烦,但无大碍

Shell

1

echo-e "n\np\n1\n\n+100M\nn\np\n2\n\n+1024M\nw\n"|fdisk /dev/sdb&> /dev/null || return 68

#格式化之前,让内核重新读取磁盘分区表,值得注意的是,有的系统版本,使用partprobe无效,譬如笔者的环境是rhel5.8,而rhel6.0以后,这个命令就很危险了,而使用partx -a /dev/sdb则效果更好…此项需慎重,如果格式化失败,则告知把失败的分区定义成变量,且跳出函数,并带出错误值69

Shell

1
2
3
4
5
6
7

`partprobe`
Part=`fdisk -l /dev/$Sd|tail -2|cut -d” ” -f1`
for M in ${Part};do
mke2fs -j $M &> /dev/null && ErrorPart=$M &&return 69
done
return 0
}

#下面代码,调用函数,接收函数返回值,根据返回值进行判断哪里出错。

Shell

1
2
3
4
5
6
7

Disk_Mod $1
Res=$?
[ $Res-eq 0 ] && exit 0
[ $Res-eq 66 ] && echo "Error! Invalid input."
[ $Res-eq 67 ] && echo "Error! Command -> dd <- Faild."
[ $Res-eq 68 ] && echo "Error! Command -> fdisk <- Faild."
[ $Res-eq 69 ] && echo "Error! Command -> mke2fs <- Faild."

热点内容
闪电矿机现货 发布:2025-05-22 06:46:05 浏览:993
如何用比特币买其他币 发布:2025-05-22 06:45:33 浏览:11
医学中心通知我去医院 发布:2025-05-22 06:42:34 浏览:148
区块链大约费用 发布:2025-05-22 06:31:01 浏览:625
区块链公司融资案例 发布:2025-05-22 06:25:51 浏览:724
比特币一致性算法 发布:2025-05-22 06:19:17 浏览:329
如何用区块链思维做游戏 发布:2025-05-22 06:04:48 浏览:184
生育保险去医保中心需要带什么 发布:2025-05-22 05:55:45 浏览:271
防止信息被篡改是区块链技术的内在属性 发布:2025-05-22 05:54:04 浏览:163
比特币大陆简介 发布:2025-05-22 05:40:40 浏览:75