Where/How are SNMP v3 passwords stored on the agent?

Security wise, SNMP v3 improves over v2 by using users for polling agents or agents sending trap data to the management system. But what if the agent is compromised? Will the attacker be able to get the password of the user used for SNMP data transfer? As far as i know the user/password credentials for SNMP v3 are stored on the agent, hence my question: Where and how are are SNMP v3 user and password credentials stored on the agent (on different operating systems, with the most common implementation of SNMP agents, i.e. net-snmp on linux, ? on windows, cisco iOS?,…)?

Need to update the DOCX file content stored in SharePoint 2013 Library using PowerShell

I have a need to update the DOCX file content using SharePoint 2013 PowerShell. I am using below code to do the same, but once file gets updated and checked in by the code, the files getting corrupted and don’t open in word application. So, please let me know if anyone have done such requirement.

foreach ($ file in $ folder.Files){ Write-Host $ file.Name Write-Host $ file.CheckOutType $ file.CheckOut() $ BinaryContent= $ file.OpenBinary() $ encode = New-Object System.Text.ASCIIEncoding $ ContentString = $ encode.GetString($ BinaryContent) Write-Host -BackgroundColor Cyan $ ContentString $ ContentString = $ ContentString -replace “kailash”,”KCS” $ file.SaveBinary($ encode.GetBytes($ ContentString)) $ file.CheckIn(“modified by code”) }

Any help is appreciated.Thanks in advance!

How can I iterate a pull data function in swift from firebase realtime database and have it stored locally Xcode

I need to pull data from my firebase realtimedatabase and store it in my app so It can be accessed in multiple view controllers

I have tried storing this already locally but in one viewcontroller and I found it easier to separate it and call it later but I don’t know how to store it properly

// clubInfoDownload.swift import Foundation import FirebaseDatabase

class clubInfoDownload {

func downloadArray() {     let ref = Database.database().reference()     ref.child("Night Clubs").queryOrderedByKey().observe(.childAdded, with: { (snapshot) in         if let valueDictionary = snapshot.value as? [String: Any] {             let address: String = valueDictionary["Address"] as? String ?? "missing addy"             let name: String = valueDictionary["Name"] as? String ?? "missing name"             let location: String = valueDictionary["Location"] as? String ?? "missing location"             let promoted: String = valueDictionary["Promoted"] as? String ?? "missing promotion"             let going: String = valueDictionary["GoingCount"] as? String ?? "missing going"             let live: String = valueDictionary["LiveCount"] as? String ?? "missing live"             let lat: String = valueDictionary["Coords/Latitude"] as? String ?? "missing Latitude"             let long: String = valueDictionary["Coords/Longitude"] as? String ?? "missing Longitude"             let type: String = valueDictionary["Type"] as? String ?? "missing type"              var coords: String = lat + "," + long             print(address, name, location, promoted, type, going, live, coords, type)         } else {             print("fail")         }     }) } 

}

so I want to store this data locally for my app, but every time I try the function runs after the data has been used so it appears as empty but really this function is being used last

Where are feature definitions/field definitions stored in the Farm and how can I delete / un-cache a field definition?

I have a solution with some field definitions and content type definitions as part of a Site scoped feature.

One of the field definitions was originally this:

<Field ID="{GUID}"         Name="MyField"         DisplayName="My Field"         Type="TaxonomyFieldType"         ShowField="Term1033"         DisplaceOnUpgrade="TRUE"         Overwrite="TRUE"         Group="My Columns">   <Customization>     <ArrayOfProperty>       <Property>           <Name>TextField</Name>           <Value xmlns:q6="http://www.w3.org/2001/XMLSchema"                   p4:type="q6:string"                   xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">             {GUID of TaxHTField0 field}           </Value>       </Property>       <Property>           <Name>IsPathRendered</Name>           <Value xmlns:q7="http://www.w3.org/2001/XMLSchema"                   p4:type="q7:boolean"                   xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">             TRUE           </Value>       </Property>     </ArrayOfProperty>   </Customization> </Field> 

I deployed the solution to my dev farm, went to a site to check everything out, and when activating the feature something went wrong and I got an error page. I collected the correlation ID, and went to the logs to see what happened.

I found some errors that called out that field specifically by name, and gave an error that

The string ‘TRUE’ is not a valid Boolean value.

Ok, I figured that came from the IsPathRendered setting. Not a big deal if I have to configure that manually, so I removed that property from the field definition, cleaned and re-published the project, and ran Update-SPSolution to deploy the updated WSP.

When trying to activate the feature again, I once again got the “string TRUE is not a valid boolean” error, although it no longer called out my field by name.

Since then I have tried

  • Update-SPSolution -Force
  • Uninstall-SPsolution, Remove-SPSolution -Force, reboot server, Add-SPsolution, Install-SpSolution -Force

and other attempts to remove/reinstall the solution, and every time, when I go to activate the feature, I keep getting the same error.

That field was the ONLY field that had the extra property on it. There are a couple other taxonomy field definitions in the feature, but they only have the string property that has the GUID of the related TaxHT0Field note field.

So apparently, that little remnant of XML from the original field definition is still stored/cached in the Farm somewhere, even though I have repeatedly tried to re-add or update the solution/feature.

WHERE IS IT?? Where can I look to get rid of the bad XML so I can get my feature activated?

Keep in mind, the feature has never been successfully activated anywhere, so doing something with a Feature upgrade is not really possible, because there’s nothing to upgrade that way.

Where are NTLM and LM hashes stored in a password protected microsoft presentation file

I have a password protected presentation file (MS office 2003).

My assignment required me to either remove the password or find it.

In my research i found out that presentation use ntlm and/or nt hashes. I also found out that office2john looks like the tool for the job.

Now my questions: How office2john extract the hashes? Where are they in the file? Can you explain to me where are they located? Or can you point me to some documentation that explain it?

How to get public key from private key stored in HSMs

I have some private keys stored on the HSM but without public keys. I want to get the corresponding public key using PKCS11 interface.

If the private key is a RSA key, I can extract the modulus from CKA_MODULUS and exponent from CKA_PUBLIC_EXPONENT, and then construct the public with these two numbers.

However, when it comes to ECDSA(or DSA) keys, how can I achieve the same goal?
CKA_EC_POINT attribute is not available for private keys.
I think the only useful information I can get is its curve parameters from CKA_EC_PARAMS, which is not enough to get the public point.

Modify string that stored in clipborad depending on random value

I wrote simple program, that will make string ‘noisy’ if clipboard contains one. What disappoints me, that i should manually check what i got from getClipboardString — in the Nothing case we just simply returning from program, otherwise we modifying string. Is there a better way to do this kind of check?

import Data.Char (toUpper) import System.Random (randomIO) import System.Clipboard (setClipboardString, getClipboardString) import Control.Monad (join)  main :: IO () main = do   join $   fmap (test doNoise) getClipboardString  where  test :: (String -> IO ()) -> (Maybe String) -> IO ()  test _ Nothing = return ()  test f (Just s) = f s   doNoise :: String -> IO ()  doNoise s = do   capsed <- (sequence $   map randCap s)   setClipboardString capsed   randCap :: Char -> IO Char  randCap x = fmap ($   x) $   fmap choice (randomIO :: IO Bool)   choice :: Bool -> (Char -> Char)  choice x = if x then toUpper else id 

Logic is stored in Components that receive input data and update output data via Observables

I have C# ASP.Net Core Webapi application that makes some calculations for physical models. I have this project class:

public class Project {     public IEnumerable<GenericComponent> components;     private ValueService valueService = new ValueService();      public Project(string norm) {         components = FactoryGenerator.GetFactory(norm).GetComponents(valueService);     }      public IEnumerable<ValueViewModel> GetResults() {         return valueService.GetResults();     }      public void SetValues(IEnumerable<ValueViewModel> values) {         values.ToList().ForEach(t => valueService.SetValue(t.Key, t.Value));     }      public bool Valid(string componentName) {         return components.Where(s => s.Title == componentName).Single().Valid();     } } 

That creates smaller components that do some calculations. Depending on the norm parameter, another set of components is created (via the factory). Each component has a list of variables that may exist (the frontend know which ones) and it can do some calculations on those variables and on variables that are being initialized in other components (with 3 example implementations of GenericComponent).

public abstract class GenericComponent : IObserver<Tuple<string, object>> {     public readonly IValueService valueService;     protected IDisposable cancellation;     public List<string> variables;     public List<string> observingVariables;      public GenericComponent(IValueService _valueService) {         valueService = _valueService;     }     public string Title { get; set; }     public void OnCompleted() { throw new NotImplementedException();   }     public void OnError(Exception error) {// no implementation     }     public abstract void OnNext(Tuple<string, object> value);      public abstract bool Valid(); }  public class LoadComponent : GenericComponent {          public LoadComponent(IValueService valueService) : base(valueService) {         variables = new List<string>() { "load" };         variables.ForEach(s => valueService.RegisterValue(s));         cancellation = valueService.Subscribe(this, variables);     }     public override bool Valid() => valueService.GetValue("load")?.Valid ?? false;     public override void OnNext(Tuple<string, object> value) {         double load = (double)value.Item2;         if (Math.Abs(load) < 1) {             valueService.SetWarning(value.Item1, "Small load, should be larger");         }     } }   public class ValidationComponent : GenericComponent {      public ValidationComponent(IValueService valueService) : base(valueService) {         variables = new List<string>() { "validation.load" };         variables.ForEach(s => valueService.RegisterValue(s));         observingVariables = new List<string>() { "load", "area" };         cancellation = valueService.Subscribe(this, observingVariables);     }     private double CalcMargin() {         return 0.5 * (double)valueService.GetValue("area").Value              - (double)valueService.GetValue("load").Value;     }     public override bool Valid() => CalcMargin() > 0;     public override void OnNext(Tuple<string, object> value) {         if (valueService.GetValue("load").Value != null &&             valueService.GetValue("area").Value != null) {             double margin = CalcMargin();             bool valid = margin > 0;             valueService.SetValue("validation.load", "margin is: " + margin.ToString(),                  valid);             if (margin < 1) {                 valueService.SetWarning("validation.load", "Very tight margin");             }         }     } }  public class CrossSectionComponent : GenericComponent {     public CrossSectionComponent(IValueService valueService) : base(valueService) {         variables = new List<string>() { "area", "radius" };         variables.ForEach(s => valueService.RegisterValue(s));         cancellation = valueService.Subscribe(this, variables);     }     public override bool Valid() => valueService.GetValue("radius")?.Valid ?? false;     public override void OnNext(Tuple<string, object> value) {         if (value.Item1 == "radius") {             double radius = (double)value.Item2;             if (radius < 0) {                 valueService.SetError("radius", "Radius is must be larger than 0");             } else if (radius < 1) {                 valueService.SetWarning("radius", "Radius is very small");             }             valueService.SetValid("radius", true);             valueService.SetValue("area", radius * radius * Math.PI, true);         }     } } 

Each component has a list of values with keys that are unique over the entire model (here I probably need more checks, whether truly all keys are unique). At the moment I use a ValueService, where each component registers its values with the respective keys. The ValueService can be used to get values from other components in order to do validation calculations or intermediate steps.

public class ValueService : IValueService {      private IDictionary<string, ValueViewModel> values = new Dictionary<string, ValueViewModel>();     private IDictionary<string, List<IObserver<Tuple<string, object>>>> observers =          new Dictionary<string, List<IObserver<Tuple<string, object>>>>();      public void RegisterValue(string key) {         if (!values.ContainsKey(key)) {             values.Add(key, new ValueViewModel() {                 Key = key,                 Value = null             });             observers.Add(key, new List<IObserver<Tuple<string, object>>>());         }     }      public IEnumerable<ValueViewModel> GetResults() {         return values.Where(s => s.Value.Value != null).Select(s => s.Value);     }      public void SetValue(string key, object value) {         if (values.ContainsKey(key)) {             values[key].Value = value;             observers[key].ForEach(t => {                 t.OnNext(new Tuple<string, object>(key, value));             });         }     }      public void SetValue(string key, object value, bool status) {         SetValue(key, value);         SetValid(key, status);     }      public void SetValid(string key, bool status) {         if (values.ContainsKey(key)) {             values[key].Valid = status;         }     }      public ValueViewModel GetValue(string key) {         if (values.ContainsKey(key))             return values[key];         return null;     }      public IDisposable Subscribe(IObserver<Tuple<string, object>> observer) {         return new Unsubscriber(observers.Values.ToList().SelectMany(s => s).ToList(), observer);     }      public IDisposable Subscribe(IObserver<Tuple<string, object>> observer, IEnumerable<string> keys) {         keys.ToList().ForEach(key => {             if (!observers.ContainsKey(key))                 observers.Add(key, new List<IObserver<Tuple<string, object>>>());             if (!observers[key].Contains(observer))                 observers[key].Add(observer);         });         return new Unsubscriber(observers.Values.ToList().SelectMany(s => s).ToList(), observer);     }      public void SetWarning(string key, string warning) {         if (values.ContainsKey(key)) {             values[key].Warning = warning;             values[key].Valid = true;         }     }      public void SetError(string key, string error) {         if (values.ContainsKey(key)) {             values[key].Error = error;             values[key].Valid = false;         }     }  } 

The ValueViewModel is used to communicate with the front end

public class ValueViewModel {     public string Key { get; set; }     public object Value { get; set; }     public bool Valid { get; set; }     public string Warning { get; set; }     public string Error { get; set; } } 

This is part of a stateless API, i.e. for each HTTP request (at the moment) a new Project object is generated and used to make validations (via an array of ValueViewModels).

My API controller looks like this:

    public IActionResult postData([FromRoute] string norm, [FromRoute] string component, [FromBody] ValueViewModel[] data)     {         Project project = new Project(norm);         project.SetValues(data);         return Ok(project.Valid(component));     } 

In order to make some local tests, I created the following console application

class Program {     static void Main(string[] args) {         Console.WriteLine("Hello world");         Project project = new Project("Eurocode_CH");         List<ValueViewModel> values = new List<ValueViewModel> {             new ValueViewModel() {                 Key = "radius",                 Value = 12.0             }         };         project.SetValues(values);       Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(project.GetResults()));         values[0].Value = -0.4;         project.SetValues(values);       Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(project.GetResults()));         values[0].Value = 0.4;         project.SetValues(values);       Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(project.GetResults()));         values.Add(new ValueViewModel() {             Key = "load",             Value = 1.2         });         project.SetValues(values);         Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(project.GetResults()));     } } 

This is the output

[{“Key”:”area”,”Value”:452.38934211693021,”Valid”:true,”Warning”:null,”Error”:null},{“Key”:”radius”,”Value”:12.0,”Valid”:true,”Warning”:null,”Error”:null}]

[{“Key”:”area”,”Value”:0.50265482457436694,”Valid”:true,”Warning”:null,”Error”:null},{“Key”:”radius”,”Value”:-0.4,”Valid”:true,”Warning”:null,”Error”:”Radius is must be larger than 0″}]

[{“Key”:”area”,”Value”:0.50265482457436694,”Valid”:true,”Warning”:null,”Error”:null},{“Key”:”radius”,”Value”:0.4,”Valid”:true,”Warning”:”Radius is very small”,”Error”:”Radius is must be larger than 0″}]

[{“Key”:”area”,”Value”:0.50265482457436694,”Valid”:true,”Warning”:null,”Error”:null},{“Key”:”radius”,”Value”:0.4,”Valid”:true,”Warning”:”Radius is very small”,”Error”:”Radius is must be larger than 0″},{“Key”:”load”,”Value”:1.2,”Valid”:false,”Warning”:null,”Error”:null}]

My concerns are

  • When the project continues, the number of components will get quite large, I fear there will be a performance issue if for each request the whole set of components needs to be generated –> should I use LazyLoading?
  • Is the ValueService approach good to share data between the components? Is there a better solution?
  • I still need to implement a specific value-getter, e.g. a user requests the ValueViewModel for a specific key, the components needs to yield an error or warning if not all values were set.
  • I think “AbstractComponent” is a better name than “GenericComponent”, on a side note.

How to call stored procedure while using jquery Data tables

I am using Jquery Data tables for my project and I am working on Asp.Net MVC 5 and entity framework 6. What I really want to do is just call my stored procedure to be called inside my jquery data tables. For now I am calling the table from my database and the call is a ajax call for jquery data table.

Here is the example of my ajax call for data table.

$  ('#studentTable').DataTable({     "ajax": {         "url": "/StructuredImportTgts/GetData",         "type": "GET",         "datatype": "json"     },     responsive: 'true',     dom: 'Bfrtip',     buttons: [         'copy', 'excel', 'pdf'     ],     "columns": [         { "data": "PART_NO" },         { "data": "LEVEL" },         { "data": "PART_NO" },         { "data": "PART_NAME" },         { "data": "L1QTY" },         { "data": "PL1" },         { "data": "PL2" },         { "data": "PL3" },         { "data": "SupplierLocID" },         { "data": "SupplierLocID" },         { "data": "Discrepancies" },         { "data": "Comments" }     ] 

The code for GETDATA() is in my controller which is as follows, it calls the table from the database and this is where I need to call my Stored procedure.

   public ActionResult GetData() {     using (Dev_Purchasing_New_ModelEntities db = new Dev_Purchasing_New_ModelEntities())     {         db.Configuration.LazyLoadingEnabled = false;         List<bomStructuredImportTgt> bomStructuredImportTgtList = db.bomStructuredImportTgts.ToList<bomStructuredImportTgt>();         return Json(new { data = bomStructuredImportTgtList }, JsonRequestBehavior.AllowGet);     } }