spirit  [ Profile ]

Sort by: Date / Title /

  1. 11 years ago and saved by 1 other
    1. # Works with dash "-" and colon ":" as a separator
    2. # The “/i” modifier at the end makes it case-insensitive (Perl-like syntax)
    3. /^([0-9A-F]{2}[:-]){5}[0-9A-F]{2}$/i
    4.  
    5. # General syntax (match lower and upper case)
    6. ^([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}$
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/429"></script>
  2. 10 years ago
    if toFixed is not defined
    1. if (!num.toFixed)
    2. {
    3.  
    4.  Number.prototype.toFixed = function(precision) {
    5.      var power = Math.pow(10, precision || 0);
    6.      return String(Math.round(this * power)/power);
    7.  }
    8.  
    9. }
    10.  
    11. // OR
    12.  
    13.   Number.prototype.toFixed = function(precision)
    14.   {
    15.      var num = (Math.round(this*Math.pow(10,precision))).toString();
    16.      return num.substring(0,num.length-precision) + "." +
    17.             num.substring(num.length-precision, num.length);
    18.   }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/1403"></script>
  3. 11 years ago
    1. function replace(str:String,find:String,replace:String):String
    2. {
    3.         var index:Number;
    4.         while(str.indexOf(find)!=-1)
    5.         {
    6.                 index= str.indexOf(find);
    7.                 str = str.substr(0,index) + replace + str.substr(index + find.length);
    8.         }
    9.         return str;
    10. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/685"></script>
  4. sponsorised links
  5. 11 years ago and saved by 1 other
    Cette commande va effectuer le status sur tous les fichiers contenus dans $liste_file_to_update, ne récupère que les lignes commençant par M (fichiers modifiés), supprime les 9 premiers caractères (pour supprimer les caractères de statut affichés par svn status) et retire les espaces et caractères numériques restant au début de la ligne.
    1. svn status -u $liste_file_to_update | egrep '^M' | cut -c 9- | sed "s/[1-9 ][1-9 ]*\//\//g"
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/1017"></script>
  6. 11 years ago and saved by 1 other
    Add user MySQL :
    
     GRANT ALL PRIVILEGES ON *.* TO 'SuperUser'@'%' IDENTIFIED BY 'SuperMotDePasse' WITH GRANT OPTION;
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/496"></script>
  7. 10 years ago
    # Activer le module
    a2enmod deflate
    
    # On compresse les types mime suivants (hmtl, texte, xml, css, js)
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
    
    # Niveau de compression
    DeflateCompressionLevel 9
    
    # Règles particulières pour navigateur non compatibles
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    
    # On log pour voir le taux de compression
    DeflateFilterNote Input input_info
    DeflateFilterNote Output output_info
    DeflateFilterNote Ratio ratio_info
    LogFormat '"%r" %{output_info}n/%{input_info}n (%{ratio_info}n%%)' deflate
    CustomLog /var/log/apache2/deflate_log deflate
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/1048"></script>
  8. 11 years ago
    ExtendedStatus will gives you a bit more information: Total Accesses, Total Traffic, CPU Usage and Load, Request/s - Bytes/s - Bytes/request
    # uncomment from /etc/apache2/apache2.conf
    ExtendedStatus On
    <Location /server-status>
        SetHandler server-status
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1 .your_domain.com
    </Location>
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/791"></script>
  9. 10 years ago
    Most vulnerability scanners will complain about TRACE method being enabled on the web server tested. This tip disable it and return a 403 FORBIDDEN error to the client (apache versions newer than 1.3.34 for the legacy branch, and 2.0.55 for apache2).
    This needs to be added in the main server config and the default is enabled (on):
    
    TraceEnable Off
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/1337"></script>
  10. 10 years ago
    Aucune erreur DOM n'est générée avec cette méthode
    1. // styleFloat, IE
    2. // cssFloat , Safari ou Firefox
    3. // styleFloat and cssFloat,  Opera
    4.  
    5. //assignation 
    6. var el = document.getElementById('element_id');
    7. el.style.styleFloat = 'left';
    8. el.style.cssFloat = 'left';
    9. //récupération
    10. var elFloat = (typeof el.style.cssFloat === 'string') ? el.style.cssFloat : el.style.styleFloat;
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/1420"></script>
  11. 6 years ago
    1. #Adding/Modifying Rules
    2.  
    3. #    Watch for files
    4.  
    5. auditctl -w /etc/yum.conf -p wa  -k yum_watch
    6. auditctl -w /usr/bin/nmap -p x   -k nmap_watch
    7. auditctl -w /etc/shadow   -p rwa -k shadow_watch
    8.  
    9. #    Remove a rule using auditctl
    10.  
    11. auditctl -W /etc/shadow -p rwa -k shadow_watch
    12.  
    13. #    Watching for ptrace system call
    14.  
    15. auditctl -a entry,always -F arch=b64 -S ptrace -k info_scan
    16.  
    17. #    Suppress 32bit clock_gettime & fstat64 system calls
    18.  
    19. -a entry,never -F arch=b32 -S clock_gettime -k clock_gettime
    20. -a entry,never -F arch=b32 -S fstat64 -k fstat64
    21.  
    22. #    Audit files opened by a specific user
    23.  
    24. auditctl -a exit,always -S open -F auid=2010
    25. auditctl -a exit,always -F arch=b64 -F auid=2010  -F uid=2010 -F path=/etc/hosts -S open
    26.  
    27. #    Audit unsuccessful attempts for multiple system calls where user id is greater than or equal to 500
    28.  
    29. auditctl -a always,exit -F arch=b32 -S creat -S open -S openat -S truncate -S ftruncate -F exit=-EACCES -F auid>=500
    30. auditctl -a always,exit -F arch=b32 -S creat -S open -S openat -S truncate -S ftruncate -F exit=-EPERM -F auid>=500
    31.  
    32. #Reporting/Searching
    33.  
    34. #    List all rules
    35.  
    36. auditctl -l
    37.  
    38. #    List status
    39.  
    40. auditctl -s
    41.  
    42. #    Report on watched files. Date format is local to the server's date format.
    43.  
    44. aureport -f
    45. aureport -f --start 02/18/10 17:42:00
    46. aureport -f --start 02/18/10 17:00:00 --end 02/18/10 17:10:00
    47. aureport -f -ts this-week
    48. aureport -f -ts today
    49.  
    50. #    Search by system call
    51.  
    52. ausearch -sc ptrace -i
    53.  
    54. #    Search for user id or effective user id
    55.  
    56. ausearch -ui 2010
    57. ausearch -ue 2010
    58.  
    59. #    Lists all auth attempts and their result
    60.  
    61. aureport -au
    62.  
    63. #    List just logins
    64.  
    65. aureport -l
    66.  
    67. #    List account modification attempts.
    68.  
    69. aureport -m
    70.  
    71. #    Search events where success value is no, User id is 500 and key is nmap_watch
    72.  
    73. ausearch -sv no -ua 500 -k nmap_watch
    74.  
    75. #    Search by executable
    76.  
    77. ausearch -x /usr/bin/nmap
    78.  
    79. #    Search by terminal
    80.  
    81. ausearch -tm pts/0
    82.  
    83. #    Search by daemon. Stuff like cron log terminal as the daemon name
    84.  
    85. ausearch -tm cron
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2171"></script>

First / Previous / Next / Last / Page 1 of 22 (211 posteets)