Jump to content

bc-vnt

Active Members
  • Posts

    595
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by bc-vnt

  1. Nici nu este vreun vers in melodtia de la Don Cafè in care sa zica " She is one in a milion " Spune " She makes me feel like a man "
  2. I-am trimis eu melodia prin PM acum vreo 2 zile ,credeam ca a postato Iar aici albumele lui Cliff , pentru ca originalele sunt mai frumoase .
  3. Daca nu ai nimic pe numele tau ( casa , masica etc ) da-le jet , din pripria experienta iti zic , in 5 ani dupa denuntu' lor expira tot . Si dupa iti poti face altu la ei, asa am facut eu cu Vodafone , am vorbit de pe abonament de vreo 12 milioane , dupa care au inceput cu amenintari vreo 2 luni , apoi mi-a venit un plic prin care ma anuntau ca ma dau in judecata , am fost am vorbit cu un avocat , el m-a invatat asta . So ... fuck orange .
  4. Nu am spus nimic , man am facut un gest pentru colegi sa nu mai stea ei sa scaneze , nu te mai agita ,ca eu nu acuz
  5. bc-vnt

    Fun stuff

    Bula in copac . Vine tac-su . - Bula da-te jos imediat. - Nu vreau ! - Ce faci acolo ? - Mananc cirese ... ! - Pai asta este plop mai Bula ... ! - Stiu, dar ce nu am voie sa-mi aduc cirese de acasa !?!
  6. Incearca sa deschizi pozele cu altceva decat Windows viewer , am patit-o si eu , dar am instalat picasa si si-a revenit .
  7. Ai aici ceea ce iti trebuie .
  8. bc-vnt

    Fun stuff

    ) http://www.youtube.com/watch?v=mlrhYuyKPBE&feature=related
  9. Multumesc , nu stiam de varianta asta , eu am pus ceea ce stiu .
  10. Cum sa folositi " Google search encrypted " Acum , acesta este link-ul unde gasiti si addon-ul pentru instalare - ADDON Acum mergem pe pagina addon-ului , il instalam , dam RESTART la browser pentru al putea face functional . Acum intram pe " Google " iar in textbox-ul de search dam click dreapta si selectam " Add to the search bar " Creeam un Search bar Dupa ce am facut toate acestea ne va aparea o fereastra unde ne va cere sa dam un nume la search bar-uli, sa selectam o iconita si sa ii adaugam un keyword . Dupa ce am facut toate acestea , ne uitam in search bar si vedem creatia noastra cu numele pe care i l-am ales . Si FELICITARI acum aveti un Search bar cryptat . Pentru a face creatia default , adica de fiecare data cand deschidem browser-ul sa deschida " Google search crypted " mergem la : MANAGE SEARCH ENGINES -> SELECTAM NUMELE CREEATIEI NOASTRE SI BIFAM " OK " P.S - Merge doar pe FF. P.S2 - sorry pentru titlu acum am vazut :">
  11. Download py2exe Instalezi py2exe apoi deschizi CMD , intri in folderu python : cd python26(versiune ) sau cd programs\python ( depinde unde ai instalat python ) apoi dai : dir ( pentru a vedea programele salvate ) Dupa toate astea deschizi python unde scrii codul ( IDLE ) si introduci asta . from distutils.core import setup import py2exe setup (console=["numeleprogramului.py"]) apoi inchizi IDLE si te ca intreba daca vrei sa il salvezi , dai YES si il salvezi cu nume de " setup.py" - fara ghilimele . acum inca o data " dir "in CMD ai sa gasesti acum in dir si " setup.py " pe care tocmai l-ai salvat acum introdu in CMD : python setup.py install apoi : python setup.py py2exe Acum ai un exe din python py2exe , il instalezi langa python , sa nu dezinstalezi python .
  12. Ce este apache ? Ce este MySQL ? Ce este PHP ? Ce este libapache ? Cum procedam pentru instalare ? Pai mai intai de toate instal Apache apoi MySQL si PHP Pentru instalare Apache sudo apt-get install apache2 apoi PHP ( eu am ales PHP5 ) sudo apt-get install php-mysql apoi: apt-get install libapache2-mod-php5 apoi : sudo apt-get install myql-server Dupa ce am facut toate acestea mai ales dupa ce am instalat MySQL-Server Ne va cere sa introducem o parola . Acum comenzile pentru update si upgrade sudo apt-get update sudo apt-get upgrade Acum dupa ce ati urmat intocmai pasii , avem un server pe systemul nostru UBUNTU . Ca sa verificam daca server-ul este instalat corect, scriem acest cod in TERMINAL : ifconfig | grep inet Copiem IP care ar trebuii sa arate ceva in genul : 192.168.1.249 , Deschidem o pagina de internet si punem ip-ul , ar trebuii sa atate cam asa : Acum creeam un folder pentru backup : sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak iar acum configuram server-ul : sudo nano /etc/apache2/apache2.conf dupa ce am introdus acest cod pentru configurare cautam linia "ServerTokens Full " si o setam " ServerTokens Prod " Cam asa Acum duceti-va inca putin in jos si trebuie sa gasiti o linie ca asta " ServerSignature On " , dar o setati " ServerSignature Off " acum apasati CTRL+O dupa care CTRL+X , pentru a salva si a iesi din config. Acum vom umbla un pic la PHP : Nu uitam sa copiem totul pentru backup : sudo cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini.bak Deschidem PHP pentru configurare asa : sudo nano /etc/php5/apache2/php.ini si cautati linia " expose_php = On " si o setati " expose_php = Off " Inca o data salvam si iesit : CTRL+O / CTRL+X Si dam restart la server : sudo /etc/init.d/apache2 restart Acum sa ne instalam un firewall sa fim un pic protejati . sudo apt-get install shorewall Acum inca o data CTRL+O / CTRL+X Copiem totul pentru backup : sudo cp /usr/share/doc/shorewall-common/examples/one-interface/* /etc/shorewall/ si deschidem fisierul pentru editarea firewall-ului : sudo nano /etc/shorewall/rules O sa aveti undeva o linie " #LAST LINE " sub aceasta linie adaugati : HTTP/ACCEPT net $FW SSH/ACCEPT net $FW Acum salvam si iesim : CTRL+o / CTRL+x Acum ii spunem firewall-ului sa porneasca o data cu server-ul : sudo nano /etc/shorewall/shorewall.conf apoi : Linia " STARTUP_ENABLED=No " o setam " STARTUP_ENABLED=Yes " Acum salvam si iesim : CTRL+O / CTRL+X Deschidem din nou fisierul firewall-ului pentru a mai modifica ceva : sudo nano /etc/default/shorewall Acum cautam linia " startup=0 " si o setam " startup=1 " Nu uitam sa salvam si sa iesit : CTRL+O - CTRL+X .
  13. Ce este SSH ? Ca sa putem verifica starea serviciilor , logurilor si a altor task-uri putem folosii server-ul OpenSSH. Cum procedam ? a) Instalam clientul SSH . sudo apt-get install openssh-client Instalarea server-ului pe pc-ul tinta ( adica al tau ) sudo apt-get install openssh-server Acum testam server-ul , sa vedem daca este pornit . netstat -ant | grep 22 Ce este grep ? sau : ps -ef | grep ssh Acum ca sa ne conectam la server-ul SSH . ssh user@ip-calculator sau: ssh user@ip-server:port Pentru a orpi server-ul SSH . sudo /etc/init.d/ssh stop P.S - Nu radeti de desktop-ul meu , asa retin comenzile mai repede .
  14. Mai mult ca sa ma obisnuiesc cu terminalul man , ca am folosit windows vreo 10 ani si ... sunt cam dependent , vreau sa ma dezobisnuiesc cat mai repede de interfata grafica .
  15. Ieri un coleg de pe forum mi-a recomandat un canal de mIRC (freenode: #ubuntu-ro ) pentru a invata cate ceva de acolo si de gasi raspunsuri la anumite probleme pe care le voi intalni cat lucrez cu LINUX , eu fiind incepator , am incercat sa descarc mIRC de pe internet , dar nu am reusit sa il instalez , asa ca m-am gandit, ar putea fii o metoda de a instala mIRC prin TERMINAl ( CTRL+T ) si da exista . Cum procedam ? Pai mai intai trebuie sa stim ce este IRSSI , apoi 2 comenzi pentru terminal , una pentru instalare si alta pentru rulare . Instalare : sudo apt-get install irssi Acum dupa ce am executat acesta comanda : sudo apt-get update Ce inseamna update ? dupa: sudo apt-get upgrade Ce inseamna upgrade ? Dupa ce ati facut toate astea ,va va aparea asa : Install : Update : Upgrade : Pentru a rula si conecta la un server apoi canal : Pentru rulare : irssi Pentru a te conecta la un server : /server irc.freenode.net Pentru a te conecta la un canal : /Join to #ubuntu-ro Conectare la server : Conectare la canal : Daca dorim sa schimbam nick-name : /nick test Schimbare nick-name : Daca dorim sa " curatam " terminalul cu de tot ce s-a intamplat pana acum si sa ramanem doar cu postarea de mesaje ( stergem output ) Stergere output : Sper sa va placa , acum invat , iar eu fiind incepator ceea ce invat dau mai departe , stiu sigur ca nu sunt singurul pe " teritoriul " LINUX .
  16. What is Two Factor Authentication? Two Factor Authentication is a way to authenticate users using two of the three valid authentication factors: something the user knows (password, PIN, etc), something the user has (smart card, phone, ATM card, etc.), and something the user is (biometric data, including figerprints). In the case of this article, we will be using something the user knows, a password, and something the user has, a smartphone. What is Google Authenticator? Google Authenticator is a software based two-factor authentication token. It is available on iOS, Android, and BlackBerry operating systems. It provides a 6 digit, time or counter based number that acts as the 2nd factor for our two factor authentication. Here is a describing Google Authenticator. How does it work? Google Authenticator implements the algorithms defined in RFC 4226 and RFC 6238 . The first is a counter based implementation of two-factor authentication. The second is a time-based implementation. First, the server and the user agree on a secret key to use as the seed value for the hashing function. The user can type in this key to Google Authenticator or use a QR code to automatically set up your application. Then Google Authenticator uses one of the above algorithms to generate a code to be entered during authentication. Your server will then use the same algorithm and secret key to check the code. Once the secret key has been agreed on, the only data passing between the client and your server will be the 6-digit key generated by the Google Authenticator application. At no time does any of this data pass through Google's servers. Counter Based One Time Password Generation To generate a one-time password, we need three pieces of information, the secret key, the counter number, and the number of digits the output should be. Since we are using Google Authenticator, we are limited to 6 digits. Here is the full GeneratePassword method: public static string GeneratePassword(string secret, long iterationNumber, int digits = 6) { byte[] counter = BitConverter.GetBytes(iterationNumber); if (BitConverter.IsLittleEndian) Array.Reverse(counter); byte[] key = Encoding.ASCII.GetBytes(secret); HMACSHA1 hmac = new HMACSHA1(key, true); byte[] hash = hmac.ComputeHash(counter); int offset = hash[hash.Length - 1] & 0xf; int binary = ((hash[offset] & 0x7f) << 24) | ((hash[offset + 1] & 0xff) << 16) | ((hash[offset + 2] & 0xff) << 8) | (hash[offset + 3] & 0xff); int password = binary % (int)Math.Pow(10, digits); // 6 digits return password.ToString(new string('0', digits)); } Let's go through what we are doing. First, we convert the iteration number to a byte[], which can be hashed using the HMAC-SHA-1 hash method. The iteration number should be incremented on the client and server every time authentication succeeds. We use the managed HMAC-SHA-1 hashing method available from the System.Security.Cryptography.HMACSHA1 class. Next we compute the hash for the current value of the counter. The next part of the code extracts the binary value of a 4 byte integer, then shrinks it to the number of digits required. That's it. The entire algorithm in 25 lines. RFC 4226 Section 5.4 has a good example and description of what is happening, which I will copy and paste here: 5.4. Example of HOTP Computation for Digit = 6 The following code example describes the extraction of a dynamic binary code given that hmac_result is a byte array with the HMAC- SHA-1 result: int offset = hmac_result[19] & 0xf ; int bin_code = (hmac_result[offset] & 0x7f) << 24 | (hmac_result[offset+1] & 0xff) << 16 | (hmac_result[offset+2] & 0xff) << 8 | (hmac_result[offset+3] & 0xff) ; SHA-1 HMAC Bytes (Example) ------------------------------------------------------------- | Byte Number | ------------------------------------------------------------- |00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19| ------------------------------------------------------------- | Byte Value | ------------------------------------------------------------- |1f|86|98|69|0e|02|ca|16|61|85|50|ef|7f|19|da|8e|94|5b|55|5a| -------------------------------***********----------------++| * The last byte (byte 19) has the hex value 0x5a. * The value of the lower 4 bits is 0xa (the offset value). * The offset value is byte 10 (0xa). * The value of the 4 bytes starting at byte 10 is 0x50ef7f19, which is the dynamic binary code DBC1. * The MSB of DBC1 is 0x50 so DBC2 = DBC1 = 0x50ef7f19 . * HOTP = DBC2 modulo 10^6 = 872921. We treat the dynamic binary code as a 31-bit, unsigned, big-endian integer; the first byte is masked with a 0x7f. We then take this number modulo 1,000,000 (10^6) to generate the 6- digit HOTP value 872921 decimal. Time Based One Time Password Generation RFC 6238 defines the time based implementation of the one time password generation. Time based one time password generation builds on the counter based approach above. It is exactly the same, except it automatically defines the counter based on intervals of time since the Unix epoch (Jan 1, 1970, 00:00 UTC). Technically, the RFC allows for any start date and time interval, but Google Authenticator requires the Unix epoch and a 30 second time interval. What this means is that we can get the current one-time-password using only the secret key. Here is how: public static readonly DateTime UNIX_EPOCH = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); public static string GetPassword(string secret) { long counter = (long)(DateTime.UtcNow - UNIX_EPOCH).TotalSeconds / 30; return HashedOneTimePassword.GeneratePassword(secret, counter); } As you can see, we are just getting the number of 30 second intervals since the Unix epoch and using that as our counter value. This means that the clock on both the client and the server need to be kept in sync with each other. This is commonly done with the Network Time Protocol. How do I put it to use? Well, now we have covered how the code works, the next question is how do you use it? I have created some extra overloads for the GetPassword method for time-based generation, and added an IsValid method. public static bool IsValid(string secret, string password, int checkAdjacentIntervals = 1) { if (password == GetPassword(secret)) return true; for (int i = 1; i <= checkAdjacentIntervals; i++) { if (password == GetPassword(secret, GetCurrentCounter() + i)) return true; if (password == GetPassword(secret, GetCurrentCounter() - i)) return true; } return false; } IsValid helps a little with clock skew by checking adjacent intervals for the password as well. This can help improve user experience a lot, because it doesn't require the clocks to be perfectly aligned. m Create the TwoFactorProfile Class Next we create a Profile class that inherits from ProfileBase. This will store the 2 factor secret for a given user. public class TwoFactorProfile : ProfileBase { public static TwoFactorProfile CurrentUser { get { return GetByUserName(Membership.GetUser().UserName); } } public static TwoFactorProfile GetByUserName(string username) { return (TwoFactorProfile)Create(username); } public string TwoFactorSecret { get { return (string)base["TwoFactorSecret"]; } set { base["TwoFactorSecret"] = value; Save(); } } } Modify the web.config Modify the <system.web><profile> element to inherit from the TwoFactorProfile class we just created: <profile inherits="TwoFactorWeb.TwoFactorProfile"> Modify AccountController We need to modify AccountController in a few places. First, the Register action needs to be modified to send the user to the ShowTwoFactorSecret page, so they can set up their Google Authenticator. In the Register action, modify the RedirectToAction from: return RedirectToAction("Index", "Home"); to: return RedirectToAction("ShowTwoFactorSecret", "Account"); Next we create the ShowTwoFactorSecret action: [Authorize] public ActionResult ShowTwoFactorSecret() { string secret = TwoFactorProfile.CurrentUser.TwoFactorSecret; if (string.IsNullOrEmpty(secret)) { byte[] buffer = new byte[9]; using (RandomNumberGenerator rng = RNGCryptoServiceProvider.Create()) { rng.GetBytes(buffer); } // Generates a 10 character string of A-Z, a-z, 0-9 // Don't need to worry about any = padding from the // Base64 encoding, since our input buffer is divisible by 3 TwoFactorProfile.CurrentUser.TwoFactorSecret = Convert.ToBase64String(buffer).Substring(0, 10).Replace('/', '0').Replace('+', '1'); secret = TwoFactorProfile.CurrentUser.TwoFactorSecret; } var enc = new Base32Encoder().Encode(Encoding.ASCII.GetBytes(secret)); return View(new TwoFactorSecret { EncodedSecret = enc }); } This just generates a new random 10 character secret, then shows it to the user in Base32 encoded format, which is how Google Authenticator expects the user to enter it. Feel free to create your secret any way you want, but it needs to be at least 10 characters or Google Authenticator will complain. Finally, we change the LogOn action to check the code provided by the user to ensure it is valid. Our new LogOn action is below: [HttpPost] public ActionResult LogOn(LogOnModel model, string returnUrl) { if (ModelState.IsValid) { if (Membership.ValidateUser(model.UserName, model.Password)) { var profile = TwoFactorProfile.GetByUserName(model.UserName); if (profile != null && !string.IsNullOrEmpty(profile.TwoFactorSecret)) { if (TimeBasedOneTimePassword.IsValid(profile.TwoFactorSecret, model.TwoFactorCode)) { FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe); if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) { return Redirect(returnUrl); } else { return RedirectToAction("Index", "Home"); } } else { ModelState.AddModelError("", "The two factor code is incorrect."); } } else { ModelState.AddModelError("", "The two factor code is incorrect."); } } else { ModelState.AddModelError("", "The user name or password provided is incorrect."); } } // If we got this far, something failed, redisplay form return View(model); } Modify AccountModels To make the new LogOn and ShowTwoFactorSecret actions work, we need to add a field to the LogOnModel class: [Required] [Display(Name = "Google Authenticator Code")] public string TwoFactorCode { get; set; } and create our new TwoFactorSecret class: public class TwoFactorSecret { public string EncodedSecret { get; set; } } Modify the LogOn.cshtml View Now we modify the LogOn view to add the new TwoFactorCode field the user needs to enter: <div class="editor-label"> @Html.LabelFor(m => m.TwoFactorCode) </div> <div class="editor-field"> @Html.TextBoxFor(m => m.TwoFactorCode) @Html.ValidationMessageFor(m => m.TwoFactorCode) </div> Create the ShowTwoFactorSecret View Finally, we create the ShowTwoFactorSecret view: @model TwoFactorWeb.Models.TwoFactorSecret @{ ViewBag.Title = "ShowTwoFactorSecret"; } <h2>Show Two Factor Secret</h2> <p> Add the code below to Google Authenticator: </p> <p> @Html.QRCode(string.Format("otpauth://totp/MY_APP_LABEL?secret={0}", Model.EncodedSecret)) </p> <p> @Model.EncodedSecret </p> As you can see, we show an image of a QR code the user can scan and we also show the secret as a string the user can manually enter. The format of the QR code is defined here. See the result After registering as a new user in the web application, you should see a screen like the following: At this point, you should scan the QR code with the Google Authenticator app, or enter the code below the QR code manually: Now, when you log in, you should see a new field to enter your "Google Authenticator Code": Just enter the current 6-digit code on the Google Authenticator screen for your application: If you entered your username, password and code correctly, you should be able to log in. http://www.codeproject.com/Articles/403355/Implementing-Two-Factor-Authentication-in-ASP-NET
  17. Da - Enjoi Si apoi ca sa nu zici ca sunt un nesimtit aici .
  18. I have added new books, enjoy!
×
×
  • Create New...